org.apache.camel.spi
Interface ShutdownPrepared

All Known Subinterfaces:
ShutdownAware
All Known Implementing Classes:
AggregateProcessor, DirectConsumer, FileConsumer, GenericFileConsumer, ScheduledBatchPollingConsumer, SedaConsumer

public interface ShutdownPrepared

Allows a Service to prepare for shutdown.

Important: Implementators of this interface must be a Service as well.

This allows Processors to prepare for shutdown, such as when CamelContext or a Route is shutting down. The Processor could be a stateful EIP such as the AggregateProcessor, allowing it to do custom work to prepare for shutdown.


Method Summary
 void prepareShutdown(boolean forced)
          Prepares for shutdown.
 

Method Detail

prepareShutdown

void prepareShutdown(boolean forced)
Prepares for shutdown.

The ShutdownStrategy supports preparing for shutdown using two steps. First a regular preparation, where the given forced parameter will be false. And if the shutdown times out, then the ShutdownStrategy performs a more aggressive shutdown, calling this method a second time with true for the given forced parameter.

For example by graceful stopping any threads or the likes.

For forced shutdown, then the service is expected to aggressively shutdown any child services, such as thread pools etc. This is the last chance it has to perform such duties.

Parameters:
forced - true is forcing a more aggressive shutdown, false is for preparing to shutdown.


Apache CAMEL