public interface PerthreadManager
Modifier and Type | Method and Description |
---|---|
void |
addThreadCleanupCallback(Runnable callback)
Adds a callback to be invoked when
cleanup() is invoked; callbacks are then removed. |
void |
addThreadCleanupListener(ThreadCleanupListener listener)
Deprecated.
Deprecated in 5.4, use
addThreadCleanupCallback(Runnable) instead. |
void |
cleanup()
Immediately performs a cleanup of the thread, invoking all callback, then discarding all per-thread data
stored by the manager (including the list of callbacks).
|
<T> PerThreadValue<T> |
createValue()
Creates a value using a unique internal key.
|
<T> ObjectCreator<T> |
createValue(ObjectCreator<T> delegate)
Return
ObjectCreator , which for each thread,
the first call will use the delegate ObjectCreator to create
an instance, and later calls will reuse the same per-thread instance. |
<T> T |
invoke(Invokable<T> invokable)
Returns the result from the invocation, providing a try...finally to cleanup after.
|
void |
run(Runnable runnable)
Invokes
Runnable.run() , providing a try...finally to cleanup after. |
void addThreadCleanupListener(ThreadCleanupListener listener)
addThreadCleanupCallback(Runnable)
instead.cleanup()
.listener
- to addvoid addThreadCleanupCallback(Runnable callback)
cleanup()
is invoked; callbacks are then removed.callback
- void cleanup()
<T> PerThreadValue<T> createValue()
<T> ObjectCreator<T> createValue(ObjectCreator<T> delegate)
ObjectCreator
, which for each thread,
the first call will use the delegate ObjectCreator
to create
an instance, and later calls will reuse the same per-thread instance. The instance is stored in the
PerthreadManager
and will be released at the end of the request.void run(Runnable runnable)
Runnable.run()
, providing a try...finally to cleanup after.${project.version} - Copyright © 2003-2015 The Apache Software Foundation.