|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultShutdownStrategy
public class DefaultShutdownStrategy
Default ShutdownStrategy
which uses graceful shutdown.
setTimeout(long)
and
setShutdownNowOnTimeout(boolean)
methods.
Routes will by default be shutdown in the reverse order of which they where started.
You can customize this using the setShutdownRoutesInReverseOrder(boolean)
method.
Constructor Summary | |
---|---|
DefaultShutdownStrategy()
|
|
DefaultShutdownStrategy(CamelContext camelContext)
|
Method Summary | |
---|---|
protected void |
doShutdown()
Implementations override this method to perform customized shutdown |
protected boolean |
doShutdown(CamelContext context,
List<RouteStartupOrder> routes,
long timeout,
TimeUnit timeUnit,
boolean suspendOnly,
boolean abortAfterTimeout)
|
protected void |
doStart()
|
protected void |
doStop()
|
CamelContext |
getCamelContext()
Get the CamelContext |
long |
getTimeout()
Gets the timeout. |
TimeUnit |
getTimeUnit()
Gets the time unit used |
boolean |
isShutdownNowOnTimeout()
Whether to force shutdown of all consumers when a timeout occurred. |
boolean |
isShutdownRoutesInReverseOrder()
Whether to shutdown routes in reverse order than they where started. |
void |
setCamelContext(CamelContext camelContext)
Injects the CamelContext |
void |
setShutdownNowOnTimeout(boolean shutdownNowOnTimeout)
Sets whether to force shutdown of all consumers when a timeout occurred and thus not all consumers was shutdown within that period. |
void |
setShutdownRoutesInReverseOrder(boolean shutdownRoutesInReverseOrder)
Sets whether routes should be shutdown in reverse or the same order as they where started. |
void |
setTimeout(long timeout)
Set an timeout to wait for the shutdown to complete. |
void |
setTimeUnit(TimeUnit timeUnit)
Set the time unit to use |
void |
shutdown(CamelContext context,
List<RouteStartupOrder> routes)
Shutdown the routes |
void |
shutdown(CamelContext context,
List<RouteStartupOrder> routes,
long timeout,
TimeUnit timeUnit)
Shutdown the routes using a specified timeout instead of the default timeout values |
boolean |
shutdown(CamelContext context,
RouteStartupOrder route,
long timeout,
TimeUnit timeUnit,
boolean abortAfterTimeout)
Shutdown the route using a specified timeout instead of the default timeout values and supports abortAfterTimeout mode |
protected void |
shutdownNow(Consumer consumer)
Shutdown the consumer immediately. |
protected void |
shutdownNow(List<Consumer> consumers)
Shutdown all the consumers immediately. |
protected void |
shutdownRoutesNow(List<RouteStartupOrder> routes)
Shutdown all the consumers immediately. |
void |
suspend(CamelContext context,
List<RouteStartupOrder> routes)
Suspends the routes |
void |
suspend(CamelContext context,
List<RouteStartupOrder> routes,
long timeout,
TimeUnit timeUnit)
Suspends the routes using a specified timeout instead of the default timeout values |
protected void |
suspendNow(Consumer consumer)
Suspends/stops the consumer immediately. |
Methods inherited from class org.apache.camel.impl.ServiceSupport |
---|
addChildService, doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.camel.Service |
---|
start, stop |
Constructor Detail |
---|
public DefaultShutdownStrategy()
public DefaultShutdownStrategy(CamelContext camelContext)
Method Detail |
---|
public void shutdown(CamelContext context, List<RouteStartupOrder> routes) throws Exception
ShutdownStrategy
shutdown
in interface ShutdownStrategy
context
- the camel contextroutes
- the routes, ordered by the order they was started
Exception
- is thrown if error shutting down the consumers, however its preferred to avoid thispublic void suspend(CamelContext context, List<RouteStartupOrder> routes) throws Exception
ShutdownStrategy
suspend
in interface ShutdownStrategy
context
- the camel contextroutes
- the routes, ordered by the order they was started
Exception
- is thrown if error suspending the consumers, however its preferred to avoid thispublic void shutdown(CamelContext context, List<RouteStartupOrder> routes, long timeout, TimeUnit timeUnit) throws Exception
ShutdownStrategy
shutdown
in interface ShutdownStrategy
context
- the camel contextroutes
- the routes, ordered by the order they was startedtimeout
- timeouttimeUnit
- the unit to use
Exception
- is thrown if error shutting down the consumers, however its preferred to avoid thispublic boolean shutdown(CamelContext context, RouteStartupOrder route, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout) throws Exception
ShutdownStrategy
shutdown
in interface ShutdownStrategy
context
- the camel contextroute
- the routetimeout
- timeouttimeUnit
- the unit to useabortAfterTimeout
- should abort shutdown after timeout
Exception
- is thrown if error shutting down the consumer, however its preferred to avoid thispublic void suspend(CamelContext context, List<RouteStartupOrder> routes, long timeout, TimeUnit timeUnit) throws Exception
ShutdownStrategy
suspend
in interface ShutdownStrategy
context
- the camel contextroutes
- the routes, ordered by the order they was startedtimeout
- timeouttimeUnit
- the unit to use
Exception
- is thrown if error suspending the consumers, however its preferred to avoid thisprotected boolean doShutdown(CamelContext context, List<RouteStartupOrder> routes, long timeout, TimeUnit timeUnit, boolean suspendOnly, boolean abortAfterTimeout) throws Exception
Exception
public void setTimeout(long timeout)
ShutdownStrategy
setTimeout
in interface ShutdownStrategy
timeout
- timeoutpublic long getTimeout()
ShutdownStrategy
getTimeout
in interface ShutdownStrategy
public void setTimeUnit(TimeUnit timeUnit)
ShutdownStrategy
setTimeUnit
in interface ShutdownStrategy
timeUnit
- the unit to usepublic TimeUnit getTimeUnit()
ShutdownStrategy
getTimeUnit
in interface ShutdownStrategy
public void setShutdownNowOnTimeout(boolean shutdownNowOnTimeout)
ShutdownStrategy
CamelContext
has been shutdown.
setShutdownNowOnTimeout
in interface ShutdownStrategy
shutdownNowOnTimeout
- true to force shutdown, false to leave them runningpublic boolean isShutdownNowOnTimeout()
ShutdownStrategy
isShutdownNowOnTimeout
in interface ShutdownStrategy
public boolean isShutdownRoutesInReverseOrder()
ShutdownStrategy
isShutdownRoutesInReverseOrder
in interface ShutdownStrategy
public void setShutdownRoutesInReverseOrder(boolean shutdownRoutesInReverseOrder)
ShutdownStrategy
setShutdownRoutesInReverseOrder
in interface ShutdownStrategy
shutdownRoutesInReverseOrder
- true to shutdown in reverse orderpublic CamelContext getCamelContext()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext camelContext)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
camelContext
- the Camel contextprotected void shutdownRoutesNow(List<RouteStartupOrder> routes)
routes
- the routes to shutdownprotected void shutdownNow(List<Consumer> consumers)
consumers
- the consumers to shutdownprotected void shutdownNow(Consumer consumer)
consumer
- the consumer to shutdownprotected void suspendNow(Consumer consumer)
consumer
- the consumer to suspendprotected void doStart() throws Exception
doStart
in class ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class ServiceSupport
Exception
protected void doShutdown() throws Exception
ServiceSupport
doShutdown
in class ServiceSupport
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |