Package org.apache.camel.main
Class SimpleMainShutdownStrategy
- java.lang.Object
-
- org.apache.camel.main.SimpleMainShutdownStrategy
-
- All Implemented Interfaces:
MainShutdownStrategy
- Direct Known Subclasses:
DefaultMainShutdownStrategy
public class SimpleMainShutdownStrategy extends Object implements MainShutdownStrategy
Base class forMainShutdownStrategy.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.camel.main.MainShutdownStrategy
MainShutdownStrategy.ShutdownEventListener
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description SimpleMainShutdownStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddShutdownListener(MainShutdownStrategy.ShutdownEventListener listener)Adds a shutdown listenervoidawait()Waiting for Camel Main to complete.booleanawait(long timeout, TimeUnit unit)Waiting for Camel Main to complete (with timeout).intgetExtraShutdownTimeout()booleanisRunAllowed()Returns true if the application is allowed to run.voidrestartAwait()This is used for restarting await with timeout.voidsetExtraShutdownTimeout(int extraShutdownTimeout)Extra timeout in seconds to graceful shutdown Camel.booleanshutdown()Return true if the shutdown has been initiated by the caller.
-
-
-
Method Detail
-
isRunAllowed
public boolean isRunAllowed()
Description copied from interface:MainShutdownStrategyReturns true if the application is allowed to run.- Specified by:
isRunAllowedin interfaceMainShutdownStrategy- Returns:
- true if the application is allowed to run.
-
addShutdownListener
public void addShutdownListener(MainShutdownStrategy.ShutdownEventListener listener)
Description copied from interface:MainShutdownStrategyAdds a shutdown listener- Specified by:
addShutdownListenerin interfaceMainShutdownStrategy- Parameters:
listener- the listener
-
shutdown
public boolean shutdown()
Description copied from interface:MainShutdownStrategyReturn true if the shutdown has been initiated by the caller.- Specified by:
shutdownin interfaceMainShutdownStrategy- Returns:
- true if the shutdown has been initiated by the caller.
-
await
public void await() throws InterruptedExceptionDescription copied from interface:MainShutdownStrategyWaiting for Camel Main to complete.- Specified by:
awaitin interfaceMainShutdownStrategy- Throws:
InterruptedException
-
await
public boolean await(long timeout, TimeUnit unit) throws InterruptedExceptionDescription copied from interface:MainShutdownStrategyWaiting for Camel Main to complete (with timeout).- Specified by:
awaitin interfaceMainShutdownStrategy- Parameters:
timeout- the maximum time to waitunit- the time unit of thetimeoutargument- Returns:
- true if Camel Main was completed before the timeout, false if timeout was triggered.
- Throws:
InterruptedException
-
restartAwait
public void restartAwait()
Description copied from interface:MainShutdownStrategyThis is used for restarting await with timeout.- Specified by:
restartAwaitin interfaceMainShutdownStrategy
-
getExtraShutdownTimeout
public int getExtraShutdownTimeout()
- Specified by:
getExtraShutdownTimeoutin interfaceMainShutdownStrategy
-
setExtraShutdownTimeout
public void setExtraShutdownTimeout(int extraShutdownTimeout)
Description copied from interface:MainShutdownStrategyExtra timeout in seconds to graceful shutdown Camel. When Camel is shutting down then Camel first shutdown all the routes (shutdownTimeout). Then additional services is shutdown (extraShutdownTimeout).- Specified by:
setExtraShutdownTimeoutin interfaceMainShutdownStrategy
-
-