Top Description Methods
org.glassfish.hk2.api

public @Interface InheritableThread

extends Annotation
Known Direct Implementers
org.glassfish.hk2.utilities.ServiceLocatorUtilities.InheritableThreadImpl
Annotations
@Documented
@Retention:RUNTIME
@Scope
@Target:TYPE, METHOD
Imports
java.lang.annotation.Documented, .Retention, .Target, jakarta.inject.Scope

InheritableThread is a scope that operates like org.glassfish.hk2.api.PerThread scope, except with the caveat that InheritableThread scoped services provide inheritance of values from parent thread to child thread. The lifecycle of the service is determined by the thread it is on. On a single thread only one of the service will be created and the service will be inherited by its child threads, but a new service will be created for each new non-child threads.

The InheritableThread scope is not automatically handled by a new ServiceLocator. In order to enable the InheritableThread scope * the user can either add an implementation of Context which handles it or it can use the org.glassfish.hk2.utilities.ServiceLocatorUtilities#enableInheritableThreadScope method.

Author
jwells

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString