Class ManagedObjectsFinalizer
- java.lang.Object
-
- org.glassfish.jersey.model.internal.ManagedObjectsFinalizer
-
@Singleton public class ManagedObjectsFinalizer extends Object
InvokesPreDestroymethods on all registered objects, when the injection manager is shut down. Some objects managed by Jersey are created usingInjectionManager.createAndInitialize(java.lang.Class<T>). This means that such objects are created, dependencies injected and methods annotated withPostConstructinvoked. Therefore methods annotated withPreDestroyshould be invoked on such objects too, when they are destroyed. This service invokesPreDestroyon all registered objects whenInjectionManager.shutdown()is invoked on the injection manager where this service is registered. Therefore only classes with their lifecycle linked to the injection manager that created them should be registered here.- Author:
- Petr Janouch
-
-
Constructor Summary
Constructors Constructor Description ManagedObjectsFinalizer(org.glassfish.jersey.internal.inject.InjectionManager injectionManager)Creates a new instance ofManagedObjectsFinalizer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpreDestroy()voidregisterForPreDestroyCall(Object object)Register an object for invocation of itsPreDestroymethod.
-
-
-
Constructor Detail
-
ManagedObjectsFinalizer
public ManagedObjectsFinalizer(org.glassfish.jersey.internal.inject.InjectionManager injectionManager)
Creates a new instance ofManagedObjectsFinalizer.- Parameters:
injectionManager- injection manager callpreDestroyon managed objects.
-
-
Method Detail
-
registerForPreDestroyCall
public void registerForPreDestroyCall(Object object)
Register an object for invocation of itsPreDestroymethod. It will be invoked when the injection manager is shut down.- Parameters:
object- an object to be registered.
-
preDestroy
@PreDestroy public void preDestroy()
-
-