Updated Branches:
  refs/heads/api_refactoring 293665faf -> 8c4096dc5

api: Have apiserver injected by component locator

- Instantiate apiserver by injection, so all its entities are also created and 
injected
- Make the constructor protected

Thanks to Alex for helping out on this one.

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/8c4096dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/8c4096dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/8c4096dc

Branch: refs/heads/api_refactoring
Commit: 8c4096dc5946c6d91a6445300278cb05a6a0f200
Parents: 2146687
Author: Rohit Yadav <[email protected]>
Authored: Mon Dec 10 17:38:44 2012 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Mon Dec 10 17:38:44 2012 -0800

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8c4096dc/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java 
b/server/src/com/cloud/api/ApiServer.java
index 693ab1e..8a41966 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -142,12 +142,16 @@ public class ApiServer implements HttpRequestHandler {
 
     private static ExecutorService _executor = new ThreadPoolExecutor(10, 150, 
60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new 
NamedThreadFactory("ApiServer"));
 
-    private ApiServer() {
+    protected ApiServer() {
+        super();
     }
 
     public static void initApiServer(String[] apiConfig) {
         if (s_instance == null) {
-            s_instance = new ApiServer();
+            //Injecting will create ApiServer object with all its
+            //vars injected as well, no need to do the following:
+            //s_instance = new ApiServer();
+            s_instance = ComponentLocator.inject(ApiServer.class);
             s_instance.init(apiConfig);
         }
     }

Reply via email to