Package com.google.gerrit.server.util
Class ThreadLocalRequestScopePropagator<C>
java.lang.Object
com.google.gerrit.server.util.RequestScopePropagator
com.google.gerrit.server.util.ThreadLocalRequestScopePropagator<C>
- Type Parameters:
C
- "context" type stored in theThreadLocal
.
- Direct Known Subclasses:
PerThreadRequestScope.Propagator
RequestScopePropagator
implementation for request scopes based on a ThreadLocal
context.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ThreadLocalRequestScopePropagator
(com.google.inject.Scope scope, ThreadLocal<C> threadLocal, ThreadLocalRequestContext local) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract C
continuingContext
(C ctx) Returns a new context object based on the passed in context that has no request scoped objects initialized.protected final <T> Callable<T>
Ensures that the current request state is available when the passed in Callable is invokedMethods inherited from class com.google.gerrit.server.util.RequestScopePropagator
cleanup, context, wrap, wrap
-
Constructor Details
-
ThreadLocalRequestScopePropagator
protected ThreadLocalRequestScopePropagator(com.google.inject.Scope scope, ThreadLocal<C> threadLocal, ThreadLocalRequestContext local)
-
-
Method Details
-
wrapImpl
Description copied from class:RequestScopePropagator
Ensures that the current request state is available when the passed in Callable is invoked- Specified by:
wrapImpl
in classRequestScopePropagator
- See Also:
-
continuingContext
Returns a new context object based on the passed in context that has no request scoped objects initialized.Note that some code paths expect request-scoped objects like
CurrentUser
to be constructible starting from just the context object returned by this method. For example, in the SSH scope, the context includes theSshSession
, which is used bySshCurrentUserProvider
to construct a newCurrentUser
in the new thread.- Parameters:
ctx
- the context to continue.- Returns:
- a new context.
-