Package io.awspring.cloud.sqs
Class LifecycleHandler
java.lang.Object
io.awspring.cloud.sqs.LifecycleHandler
Handler for lifecycle methods. The singleton instance should be retrieved by using the
get()
method. This class is thread-safe.
Methods accept Object instances and apply lifecycle methods then the SmartLifecycle interface is
implemented. Can handle lifecycle actions either sequentially or in parallel, according to the
parallelLifecycle property.- Since:
- 3.0
- Author:
- Tomaz Fernandes
-
Method Summary
Modifier and TypeMethodDescriptionvoidExecute theDisposableBean.destroy()method if the provided object is aDisposableBeaninstance.static LifecycleHandlerget()Get the singleton instance for this class.booleanCheck whether a object is running if it's an instance ofSmartLifecycle.voidmanageLifecycle(Consumer<SmartLifecycle> action, Object... objects) Execute the provided action if the provided objects areSmartLifecycleinstances.voidsetParallelLifecycle(boolean parallelLifecycle) Set whether lifecycle management should be handled in parallel or sequentially.voidStarts the provided objects that are aSmartLifecycleinstance.voidStarts the provided objects that are aSmartLifecycleinstance.
-
Method Details
-
get
Get the singleton instance for this class.- Returns:
- the instance.
-
setParallelLifecycle
public void setParallelLifecycle(boolean parallelLifecycle) Set whether lifecycle management should be handled in parallel or sequentially.- Parameters:
parallelLifecycle- false to disable parallel lifecycle management.
-
manageLifecycle
Execute the provided action if the provided objects areSmartLifecycleinstances.- Parameters:
action- the action.objects- the objects.
-
start
Starts the provided objects that are aSmartLifecycleinstance.- Parameters:
objects- the objects.
-
stop
Starts the provided objects that are aSmartLifecycleinstance.- Parameters:
objects- the objects.
-
isRunning
Check whether a object is running if it's an instance ofSmartLifecycle.- Parameters:
object- the object to check.- Returns:
- whether the object is running, or true if it's not a
SmartLifecycleinstance.
-
dispose
Execute theDisposableBean.destroy()method if the provided object is aDisposableBeaninstance.- Parameters:
destroyable- the object to destroy.
-