Package org.glassfish.internal.api
Interface ContextProducer
-
- All Known Subinterfaces:
JavaEEContextUtil
- All Known Implementing Classes:
JavaEEContextUtilImpl
public interface ContextProducer
Utility to create / push Jakarta EE and CDI thread contexts Example:- Author:
- lprimak
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ContextProducer.Closeable
static interface
ContextProducer.Context
static interface
ContextProducer.Instance
specific, immutable, thread-safe instance of the context
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ContextProducer.Instance
currentInvocation()
captures current invocation and returns it as an instanceContextProducer.Instance
empty()
Creates an empty instance, i.e.ClassLoader
getInvocationClassLoader()
String
getInvocationComponentId()
boolean
isInvocationLoaded()
This is different from class loaded, as there are some situations where class is loaded but initialization is not complete, such as CDI initializations, extensions start, etc.boolean
moduleMatches(ModuleInfo moduleInfo, String appOrComponentId)
Checks if the supplied module matches the component / application ID Works for both EAR application IDs or other module (WAR, JAR) IDs
-
-
-
Method Detail
-
empty
ContextProducer.Instance empty()
Creates an empty instance, i.e. if the empty context is pushed on top of another context, the other context will be 'suppressed' for the duration of this context- Returns:
- new empty instance
-
currentInvocation
ContextProducer.Instance currentInvocation() throws IllegalStateException
captures current invocation and returns it as an instance- Returns:
- new captured instance
- Throws:
IllegalStateException
-
getInvocationClassLoader
ClassLoader getInvocationClassLoader()
- Returns:
- Class Loader that's associated with current invocation or null if there is no current invocation
-
getInvocationComponentId
String getInvocationComponentId()
- Returns:
- component ID for the current invocation or null
-
isInvocationLoaded
boolean isInvocationLoaded()
This is different from class loaded, as there are some situations where class is loaded but initialization is not complete, such as CDI initializations, extensions start, etc.- Returns:
- true if current invocation exists and is loaded / ready
-
moduleMatches
boolean moduleMatches(ModuleInfo moduleInfo, String appOrComponentId)
Checks if the supplied module matches the component / application ID Works for both EAR application IDs or other module (WAR, JAR) IDs- Parameters:
moduleInfo
-appOrComponentId
-- Returns:
- true if matches
-
-