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.Logger
LOG
-
Constructor Summary
Constructors Constructor Description SimpleMainShutdownStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addShutdownListener(MainShutdownStrategy.ShutdownEventListener listener)
Adds a shutdown listenervoid
await()
Waiting for Camel Main to complete.boolean
await(long timeout, TimeUnit unit)
Waiting for Camel Main to complete (with timeout).int
getExtraShutdownTimeout()
boolean
isRunAllowed()
Returns true if the application is allowed to run.void
restartAwait()
This is used for restarting await with timeout.void
setExtraShutdownTimeout(int extraShutdownTimeout)
Extra timeout in seconds to graceful shutdown Camel.boolean
shutdown()
Return true if the shutdown has been initiated by the caller.
-
-
-
Method Detail
-
isRunAllowed
public boolean isRunAllowed()
Description copied from interface:MainShutdownStrategy
Returns true if the application is allowed to run.- Specified by:
isRunAllowed
in interfaceMainShutdownStrategy
- Returns:
- true if the application is allowed to run.
-
addShutdownListener
public void addShutdownListener(MainShutdownStrategy.ShutdownEventListener listener)
Description copied from interface:MainShutdownStrategy
Adds a shutdown listener- Specified by:
addShutdownListener
in interfaceMainShutdownStrategy
- Parameters:
listener
- the listener
-
shutdown
public boolean shutdown()
Description copied from interface:MainShutdownStrategy
Return true if the shutdown has been initiated by the caller.- Specified by:
shutdown
in interfaceMainShutdownStrategy
- Returns:
- true if the shutdown has been initiated by the caller.
-
await
public void await() throws InterruptedException
Description copied from interface:MainShutdownStrategy
Waiting for Camel Main to complete.- Specified by:
await
in interfaceMainShutdownStrategy
- Throws:
InterruptedException
-
await
public boolean await(long timeout, TimeUnit unit) throws InterruptedException
Description copied from interface:MainShutdownStrategy
Waiting for Camel Main to complete (with timeout).- Specified by:
await
in interfaceMainShutdownStrategy
- Parameters:
timeout
- the maximum time to waitunit
- the time unit of thetimeout
argument- 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:MainShutdownStrategy
This is used for restarting await with timeout.- Specified by:
restartAwait
in interfaceMainShutdownStrategy
-
getExtraShutdownTimeout
public int getExtraShutdownTimeout()
- Specified by:
getExtraShutdownTimeout
in interfaceMainShutdownStrategy
-
setExtraShutdownTimeout
public void setExtraShutdownTimeout(int extraShutdownTimeout)
Description copied from interface:MainShutdownStrategy
Extra 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:
setExtraShutdownTimeout
in interfaceMainShutdownStrategy
-
-