mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
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>
This commit is contained in:
parent
8fbbc76466
commit
151a7643ce
@ -121,7 +121,6 @@ import com.cloud.utils.exception.CSExceptionErrorCode;
|
|||||||
import com.cloud.uuididentity.dao.IdentityDao;
|
import com.cloud.uuididentity.dao.IdentityDao;
|
||||||
import com.cloud.acl.APIAccessChecker;
|
import com.cloud.acl.APIAccessChecker;
|
||||||
|
|
||||||
|
|
||||||
public class ApiServer implements HttpRequestHandler {
|
public class ApiServer implements HttpRequestHandler {
|
||||||
private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName());
|
private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName());
|
||||||
private static final Logger s_accessLogger = Logger.getLogger("apiserver." + 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 static ExecutorService _executor = new ThreadPoolExecutor(10, 150, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("ApiServer"));
|
||||||
|
|
||||||
|
|
||||||
private ApiServer() {
|
private ApiServer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,11 +153,14 @@ public class ApiServer implements HttpRequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ApiServer getInstance() {
|
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;
|
return s_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(String[] apiConfig) {
|
public void init(String[] apiConfig) {
|
||||||
BaseCmd.setComponents(new ApiResponseHelper());
|
BaseCmd.setComponents(new ApiResponseHelper());
|
||||||
BaseListCmd.configure();
|
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) {
|
public String getSerializedApiError(int errorCode, String errorText, Map<String, Object[]> apiCommandParams, String responseType, Exception ex) {
|
||||||
String responseName = null;
|
String responseName = null;
|
||||||
String cmdClassName = null;
|
String cmdClassName = null;
|
||||||
|
|
||||||
String responseText = null;
|
String responseText = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user