Interface ContextHandleFactory
- All Known Subinterfaces:
EE10ContextHandleFactory
- All Known Implementing Classes:
ClassLoaderContextHandleFactory,NamingContextHandleFactory,OtherEESetupActionsContextHandleFactory,ThreadContextProviderContextHandleFactory,TransactionContextHandleFactory,TransactionLeakContextHandleFactory
public interface ContextHandleFactory
The factory responsible for creating the context handles with the current context saved
- Author:
- Eduardo Martins
-
Method Summary
Modifier and TypeMethodDescriptionintThe factory priority is used to define the order of handles when chained.getName()Retrieves the factory's name.Reads a handle from the specified input stream.saveContext(jakarta.enterprise.concurrent.ContextService contextService, Map<String, String> contextObjectProperties) Called by ManagedExecutorService in the same thread that submits a task to save the execution context of the submitting thread.voidwriteSetupContextHandle(SetupContextHandle contextHandle, ObjectOutputStream out) Writes the handle to the specified output stream.
-
Method Details
-
saveContext
SetupContextHandle saveContext(jakarta.enterprise.concurrent.ContextService contextService, Map<String, String> contextObjectProperties) Called by ManagedExecutorService in the same thread that submits a task to save the execution context of the submitting thread.- Parameters:
contextService- ContextService containing information on what context should be savedcontextObjectProperties- Additional properties specified for for a context object when the ContextService object was created.- Returns:
- A ContextHandle that will be passed to the setup method in the thread executing the task
-
getChainPriority
int getChainPriority()The factory priority is used to define the order of handles when chained. The handle with the lowest priority is the first in the chain.- Returns:
-
getName
String getName()Retrieves the factory's name.- Returns:
-
writeSetupContextHandle
void writeSetupContextHandle(SetupContextHandle contextHandle, ObjectOutputStream out) throws IOException Writes the handle to the specified output stream.- Parameters:
contextHandle-out-- Throws:
IOException
-
readSetupContextHandle
SetupContextHandle readSetupContextHandle(ObjectInputStream in) throws IOException, ClassNotFoundException Reads a handle from the specified input stream.- Parameters:
in-- Returns:
- Throws:
IOExceptionClassNotFoundException
-