Search in sources :

Example 1 with AppContextStoppedEvent

use of com.haulmont.cuba.core.sys.events.AppContextStoppedEvent in project cuba by cuba-platform.

the class AppContext method stopContext.

/**
 * Called by the framework right before the application shutdown.
 */
static void stopContext() {
    if (!started)
        return;
    started = false;
    for (int i = listeners.size() - 1; i >= 0; i--) {
        Listener listener = listeners.get(i);
        listener.applicationStopped();
    }
    Events events = (Events) getApplicationContext().getBean(Events.NAME);
    events.publish(new AppContextStoppedEvent(context));
    if (context != null && context instanceof ConfigurableApplicationContext) {
        ((ConfigurableApplicationContext) context).close();
    }
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) Events(com.haulmont.cuba.core.global.Events) AppContextStoppedEvent(com.haulmont.cuba.core.sys.events.AppContextStoppedEvent)

Aggregations

Events (com.haulmont.cuba.core.global.Events)1 AppContextStoppedEvent (com.haulmont.cuba.core.sys.events.AppContextStoppedEvent)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1