Class DestroyableManager
- java.lang.Object
-
- ru.vyarus.guice.ext.managed.destroyable.DestroyableManager
-
- All Implemented Interfaces:
java.lang.Runnable
public class DestroyableManager extends java.lang.Object implements java.lang.RunnableManage destroyable instances. ImplementsRunnableto be used as shutdown hook.- Since:
- 30.06.2014
-
-
Constructor Summary
Constructors Constructor Description DestroyableManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Called on context shutdown to call all registered destroyable instances.voidregister(Destroyable destroyable)Register destroyable instance to be called on context shutdown.voidrun()
-
-
-
Method Detail
-
register
public void register(Destroyable destroyable)
Register destroyable instance to be called on context shutdown. Not thread safe (assuming single thread injector initialization)- Parameters:
destroyable- destroyable instance- See Also:
regsters annotated methods,registers beans anootated with
-
destroy
public void destroy()
Called on context shutdown to call all registered destroyable instances. By default called on jvm shutdown, but may be called manually to synchronise with some other container shutdown (e.g. web container) Safe to call many times, but all destroy instances will be processed only on first call. Thread safe.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
-