Top Inners Fields Constructors Methods
org.glassfish.hk2.internal

public Class InheritableThreadContext

extends Object
implements Context<InheritableThread>
Class Inheritance
All Implemented Interfaces
org.glassfish.hk2.api.Context
Annotations
@Singleton
@Visibility:LOCAL
Imports
java.lang.annotation.Annotation, org.glassfish.hk2.utilities.CleanerFactory, java.security.AccessController, .PrivilegedAction, java.util.HashMap, .Map, jakarta.inject.Singleton, org.glassfish.hk2.api.ActiveDescriptor, .Context, .DescriptorVisibility, .InheritableThread, .ServiceHandle, .Visibility, org.glassfish.hk2.utilities.reflection.Logger

Author
jwells

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final boolean
private InheritableThreadLocal<InheritableThreadContext.InheritableContextThreadWrapper>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
containsKey(ActiveDescriptor<?> descriptor)

Implements org.glassfish.hk2.api.Context.containsKey.

Determines if this context has a value for the given key

public void
destroyOne(ActiveDescriptor<?> descriptor)

Implements org.glassfish.hk2.api.Context.destroyOne.

This method is called when ServiceHandle#destroy() method is called.

public <U> U
findOrCreate(ActiveDescriptor<U> activeDescriptor, ServiceHandle<?> root)

Implements org.glassfish.hk2.api.Context.findOrCreate.

Creates a contextual instance of this ActiveDescriptor by calling its create method if there is no other matching contextual instance.

public Class<? extends Annotation>
getScope()

Implements org.glassfish.hk2.api.Context.getScope.

The scope for which this is the context

public boolean
isActive()

Implements org.glassfish.hk2.api.Context.isActive.

True if this context is active, false otherwise

public void
shutdown()

Implements org.glassfish.hk2.api.Context.shutdown.

Shut down this context.

public boolean
supportsNullCreation()

Implements org.glassfish.hk2.api.Context.supportsNullCreation.

Returns true if the findOrCreate method can return null

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOG_THREAD_DESTRUCTIONback to summary
private static final boolean LOG_THREAD_DESTRUCTION
threadMapback to summary
private InheritableThreadLocal<InheritableThreadContext.InheritableContextThreadWrapper> threadMap

Constructor Detail

InheritableThreadContextback to summary
public InheritableThreadContext()

Method Detail

containsKeyback to summary
public boolean containsKey(ActiveDescriptor<?> descriptor)

Implements org.glassfish.hk2.api.Context.containsKey.

Doc from org.glassfish.hk2.api.Context.containsKey.

Determines if this context has a value for the given key

Annotations
@Override
destroyOneback to summary
public void destroyOne(ActiveDescriptor<?> descriptor)

Implements org.glassfish.hk2.api.Context.destroyOne.

Doc from org.glassfish.hk2.api.Context.destroyOne.

This method is called when ServiceHandle#destroy() method is called. It is up to the context implementation whether or not to honor this destruction request based on the lifecycle requirements of the context

Annotations
@Override
findOrCreateback to summary
public <U> U findOrCreate(ActiveDescriptor<U> activeDescriptor, ServiceHandle<?> root)

Implements org.glassfish.hk2.api.Context.findOrCreate.

Doc from org.glassfish.hk2.api.Context.findOrCreate.

Creates a contextual instance of this ActiveDescriptor by calling its create method if there is no other matching contextual instance. If there is already a contextual instance it is returned. If parent is null then this must work like the find call

Annotations
@SuppressWarnings:unchecked
@Override
getScopeback to summary
public Class<? extends Annotation> getScope()

Implements org.glassfish.hk2.api.Context.getScope.

Doc from org.glassfish.hk2.api.Context.getScope.

The scope for which this is the context

Annotations
@Override
isActiveback to summary
public boolean isActive()

Implements org.glassfish.hk2.api.Context.isActive.

Doc from org.glassfish.hk2.api.Context.isActive.

True if this context is active, false otherwise

Annotations
@Override
shutdownback to summary
public void shutdown()

Implements org.glassfish.hk2.api.Context.shutdown.

Doc from org.glassfish.hk2.api.Context.shutdown.

Shut down this context.

Annotations
@Override
supportsNullCreationback to summary
public boolean supportsNullCreation()

Implements org.glassfish.hk2.api.Context.supportsNullCreation.

Doc from org.glassfish.hk2.api.Context.supportsNullCreation.

Returns true if the findOrCreate method can return null

Annotations
@Override
org.glassfish.hk2.internal back to summary

private final Class InheritableThreadContext.CleanableContext

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • org.glassfish.hk2.internal.InheritableThreadContext.CleanableContext
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private final long
private final Map<ActiveDescriptor<?>, Object>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Object
get(ActiveDescriptor<?> descriptor)

public boolean
has(ActiveDescriptor<?> descriptor)

public void
put(ActiveDescriptor<?> descriptor, Object value)

public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

idback to summary
private final long id
instancesback to summary
private final Map<ActiveDescriptor<?>, Object> instances

Constructor Detail

CleanableContextback to summary
private CleanableContext()

Method Detail

getback to summary
public Object get(ActiveDescriptor<?> descriptor)
hasback to summary
public boolean has(ActiveDescriptor<?> descriptor)
putback to summary
public void put(ActiveDescriptor<?> descriptor, Object value)
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
org.glassfish.hk2.internal back to summary

private Class InheritableThreadContext.InheritableContextThreadWrapper

extends Object
Class Inheritance
  • java.lang.Object
  • org.glassfish.hk2.internal.InheritableThreadContext.InheritableContextThreadWrapper

Field Summary

Modifier and TypeField and Description
private final InheritableThreadContext.CleanableContext

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
get(ActiveDescriptor<?> descriptor)

public boolean
has(ActiveDescriptor<?> descriptor)

public void
put(ActiveDescriptor<?> descriptor, Object value)

public final void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final InheritableThreadContext.CleanableContext context

Constructor Detail

InheritableContextThreadWrapperback to summary
public InheritableContextThreadWrapper()

Method Detail

getback to summary
public Object get(ActiveDescriptor<?> descriptor)
hasback to summary
public boolean has(ActiveDescriptor<?> descriptor)
putback to summary
public void put(ActiveDescriptor<?> descriptor, Object value)
registerStopEventback to summary
public final void registerStopEvent()