Package org.apache.camel.main
Class SimpleMainShutdownStrategy
java.lang.Object
org.apache.camel.main.SimpleMainShutdownStrategy
- All Implemented Interfaces:
MainShutdownStrategy
- Direct Known Subclasses:
DefaultMainShutdownStrategy
Base class for
MainShutdownStrategy.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.camel.main.MainShutdownStrategy
MainShutdownStrategy.ShutdownEventListener -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a shutdown listenervoidawait()Waiting for Camel Main to complete.booleanWaiting for Camel Main to complete (with timeout).intbooleanReturns true if the application is allowed to run.voidThis 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.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
SimpleMainShutdownStrategy
public SimpleMainShutdownStrategy()
-
-
Method Details
-
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
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
Description copied from interface:MainShutdownStrategyWaiting for Camel Main to complete.- Specified by:
awaitin interfaceMainShutdownStrategy- Throws:
InterruptedException
-
await
Description 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
-