Interface ThreadContextService
- All Superinterfaces:
ThreadContext
- All Known Implementing Classes:
DefaultThreadContextService
The ThreadContextService supports executing code in a thread context and also getting and setting attribute values in
the current thread context.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThreadContextService.Executor<R,T extends Throwable> Interface to implement for the executeInContext method.static final class -
Method Summary
Modifier and TypeMethodDescription<R,T extends Throwable>
RexecuteInContext(ThreadContextService.Executor<R, T> wrapper) Execute the wrapper code in the context of the specified userMethods inherited from interface de.hybris.platform.commerceservices.threadcontext.ThreadContext
getAttribute, removeAttribute, setAttribute
-
Method Details
-
getCurrentContext
ThreadContext getCurrentContext()- Returns:
- the current
ThreadContext
-
executeInContext
Execute the wrapper code in the context of the specified user- Type Parameters:
R- The type of the return valueT- The type of the exception thrown by the wrapper- Parameters:
wrapper- The code to execute in that context- Returns:
- The result of method being executed
- Throws:
T- The exception thrown by the wrapper if an error occurs
-