diff --git a/platform-service-framework/src/main/java/org/hypertrace/core/serviceframework/PlatformService.java b/platform-service-framework/src/main/java/org/hypertrace/core/serviceframework/PlatformService.java index 89d4f5f..e0a7c91 100644 --- a/platform-service-framework/src/main/java/org/hypertrace/core/serviceframework/PlatformService.java +++ b/platform-service-framework/src/main/java/org/hypertrace/core/serviceframework/PlatformService.java @@ -148,6 +148,8 @@ public void start() { adminServer.join(); } catch (Exception e) { LOGGER.error("Failed to start service servlet."); + this.shutdown(); + System.exit(1); } } @@ -175,12 +177,6 @@ public void shutdown() { } catch (Exception ex) { LOGGER.error("Error stopping admin server"); } - if (getServiceState() != State.STARTED) { - LOGGER.info( - "Service - {} is at state: {}. Expecting state: STARTED. Skipping shutdown...", - getServiceName(), getServiceState()); - return; - } LOGGER.info("Trying to shutdown service - {}...", getServiceName()); serviceLifecycle.setState(State.STOPPING); doStop(); @@ -189,5 +185,4 @@ public void shutdown() { PlatformMetricsRegistry.stop(); LOGGER.info("Service - {} is shutdown.", getServiceName()); } - }