Search in sources :

Example 1 with ContainerService

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");
}
Also used : ContainerService(org.openremote.model.ContainerService)

Example 2 with ContainerService

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));
}
Also used : HealthStatusProvider(org.openremote.model.system.HealthStatusProvider) ManagerWebService(org.openremote.manager.web.ManagerWebService) ContainerService(org.openremote.model.ContainerService)

Example 3 with ContainerService

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");
}
Also used : ContainerService(org.openremote.model.ContainerService)

Aggregations

ContainerService (org.openremote.model.ContainerService)3 ManagerWebService (org.openremote.manager.web.ManagerWebService)1 HealthStatusProvider (org.openremote.model.system.HealthStatusProvider)1