public class DefaultThreadContextService extends java.lang.Object implements ThreadContextService
ThreadContextService.Executor<R,T extends java.lang.Throwable>, ThreadContextService.Nothing| Constructor and Description |
|---|
DefaultThreadContextService() |
| Modifier and Type | Method and Description |
|---|---|
protected ThreadContext |
createLocalThreadContext() |
<R,T extends java.lang.Throwable> |
executeInContext(ThreadContextService.Executor<R,T> wrapper)
Execute the wrapper code in the context of the specified user
|
<T> T |
getAttribute(java.lang.String name)
Returns for the given session attribute name the value
|
ThreadContext |
getCurrentContext() |
void |
removeAttribute(java.lang.String name)
Removes the given attribute from the current session.
|
protected void |
removeLocalThreadContext() |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the given value Object to the Session as attribute with the given name
|
public ThreadContext getCurrentContext()
getCurrentContext in interface ThreadContextServiceThreadContextpublic <R,T extends java.lang.Throwable> R executeInContext(ThreadContextService.Executor<R,T> wrapper) throws T extends java.lang.Throwable
ThreadContextServiceexecuteInContext in interface ThreadContextServiceR - The type of the return valueT - The type of the exception thrown by the wrapperwrapper - The code to execute in that contextT - The exception thrown by the wrapper if an error occursT extends java.lang.Throwablepublic void setAttribute(java.lang.String name,
java.lang.Object value)
ThreadContextsetAttribute in interface ThreadContextname - the name of the attributevalue - the value to be setpublic <T> T getAttribute(java.lang.String name)
ThreadContextgetAttribute in interface ThreadContextname - the attribute namenull if no attribute with the given name is stored in the sessionpublic void removeAttribute(java.lang.String name)
ThreadContextremoveAttribute in interface ThreadContextname - the attribute nameprotected ThreadContext createLocalThreadContext()
protected void removeLocalThreadContext()
Copyright © 2018 SAP SE. All Rights Reserved.