incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [4/6] git commit: api: Don't silently fail apiserver instance initialization
Date Tue, 11 Dec 2012 01:43:55 GMT
api: Don't silently fail apiserver instance initialization

- ApiServer instance assumes cloudstartup servlet will initialize it
- Check and log if initialization fails

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


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

Branch: refs/heads/api_refactoring
Commit: 151a7643ced3a022d78eab0f6a4cf34b19928a7a
Parents: 8fbbc76
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Mon Dec 10 16:27:33 2012 -0800
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Mon Dec 10 16:27:33 2012 -0800

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


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/151a7643/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 bb14d4c..693ab1e 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -121,7 +121,6 @@ import com.cloud.utils.exception.CSExceptionErrorCode;
 import com.cloud.uuididentity.dao.IdentityDao;
 import com.cloud.acl.APIAccessChecker;
 
-
 public class ApiServer implements HttpRequestHandler {
     private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName());
     private static final Logger s_accessLogger = Logger.getLogger("apiserver." + ApiServer.class.getName());
@@ -143,7 +142,6 @@ public class ApiServer implements HttpRequestHandler {
 
     private static ExecutorService _executor = new ThreadPoolExecutor(10, 150, 60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("ApiServer"));
 
-
     private ApiServer() {
     }
 
@@ -155,11 +153,14 @@ public class ApiServer implements HttpRequestHandler {
     }
 
     public static ApiServer getInstance() {
-        // initApiServer();
+        // Assumption: CloudStartupServlet would initialize ApiServer
+        // initApiServer(null);
+        if (s_instance == null) {
+            s_logger.fatal("ApiServer instance failed to initialize");
+        }
         return s_instance;
     }
 
-
     public void init(String[] apiConfig) {
         BaseCmd.setComponents(new ApiResponseHelper());
         BaseListCmd.configure();
@@ -908,7 +909,6 @@ public class ApiServer implements HttpRequestHandler {
     public String getSerializedApiError(int errorCode, String errorText, Map<String, Object[]>
apiCommandParams, String responseType, Exception ex) {
         String responseName = null;
         String cmdClassName = null;
-
         String responseText = null;
 
         try {


Mime
View raw message