public interface ShutdownPrepared
Service
to prepare for shutdown.
Important: Implementators of this interface must be a Service
as well.
This allows Processor
s 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.Modifier and Type | Method and Description |
---|---|
void |
prepareShutdown(boolean suspendOnly,
boolean forced)
Prepares for stop/shutdown.
|
void prepareShutdown(boolean suspendOnly, boolean forced)
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.
In addition a service can also be suspended (not stopped), and when this happens the parameter
suspendOnly has the value true. This can be used to prepare the service
for suspension, such as marking a worker thread to skip action.
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.suspendOnly
- true if the intention is to only suspend the service, and not stop/shutdown the service.forced
- true is forcing a more aggressive shutdown, false is for preparing to shutdown.Apache Camel