use of org.openremote.model.ContainerService in project openremote by openremote.
the class Container method stop.
public synchronized void stop() {
if (!isRunning())
return;
LOG.info("<<< Stopping runtime container...");
List<ContainerService> servicesToStop = Arrays.asList(getServices());
Collections.reverse(servicesToStop);
try {
for (ContainerService service : servicesToStop) {
LOG.fine("Stopping service: " + service);
service.stop(this);
}
} catch (Exception ex) {
throw new RuntimeException(ex);
}
try {
LOG.info("Cancelling scheduled tasks");
((NoShutdownScheduledExecutorService) EXECUTOR_SERVICE).doShutdownNow();
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception thrown whilst trying to stop scheduled tasks", e);
}
waitingThread.interrupt();
waitingThread = null;
LOG.info("<<< Runtime container stopped");
}
use of org.openremote.model.ContainerService in project openremote by openremote.
the class HealthStatusService method init.
@Override
public void init(Container container) throws Exception {
ServiceLoader.load(HealthStatusProvider.class).forEach(healthStatusProviderList::add);
for (HealthStatusProvider healthStatusProvider : healthStatusProviderList) {
if (healthStatusProvider instanceof ContainerService) {
((ContainerService) healthStatusProvider).init(container);
}
}
container.getService(ManagerWebService.class).addApiSingleton(new StatusResourceImpl(healthStatusProviderList));
}
use of org.openremote.model.ContainerService in project openremote by openremote.
the class Container method start.
public synchronized void start() throws Exception {
if (isRunning())
return;
LOG.info(">>> Starting runtime container...");
try {
for (ContainerService service : getServices()) {
LOG.fine("Initializing service: " + service);
service.init(Container.this);
}
for (ContainerService service : getServices()) {
LOG.fine("Starting service: " + service);
service.start(Container.this);
}
} catch (Exception ex) {
LOG.log(Level.SEVERE, ">>> Runtime container startup failed", ex);
throw ex;
}
LOG.info(">>> Runtime container startup complete");
}
Aggregations