Example usage for org.springframework.integration.context OrderlyShutdownCapable beforeShutdown

List of usage examples for org.springframework.integration.context OrderlyShutdownCapable beforeShutdown

Introduction

In this page you can find the example usage for org.springframework.integration.context OrderlyShutdownCapable beforeShutdown.

Prototype

int beforeShutdown();

Source Link

Document

Called before shutdown begins.

Usage

From source file:hello.MetricsActivator.java

protected final void orderlyShutdownCapableComponentsBefore() {
    logger.debug("Initiating stop OrderlyShutdownCapable components");
    Map<String, OrderlyShutdownCapable> components = this.applicationContext
            .getBeansOfType(OrderlyShutdownCapable.class);
    for (Entry<String, OrderlyShutdownCapable> componentEntry : components.entrySet()) {
        OrderlyShutdownCapable component = componentEntry.getValue();
        int n = component.beforeShutdown();
        if (logger.isInfoEnabled()) {
            logger.info(//from   w  ww  . j  ava  2 s.  c om
                    "Initiated stop for component " + component + "; it reported " + n + " active messages");
        }
    }
    logger.debug("Initiated stop OrderlyShutdownCapable components");
}