Class PerthreadManagerImpl
java.lang.Object
org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl
- All Implemented Interfaces:
PerthreadManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addThreadCleanupCallback
(Runnable callback) Adds a callback to be invoked whenPerthreadManager.cleanup()
is invoked; callbacks are then removed.void
Adds a listener to the hub.void
cleanup()
Instructs the hub to notify all its listeners (for the current thread).<T> PerThreadValue<T>
Creates a value using a unique internal key.<T> ObjectCreator<T>
createValue
(ObjectCreator<T> delegate) ReturnObjectCreator
, which for each thread, the first call will use the delegateObjectCreator
to create an instance, and later calls will reuse the same per-thread instance.<T> T
Returns the result from the invocation, providing a try...finally to cleanup after.void
void
InvokesRunnable.run()
, providing a try...finally to cleanup after.
-
Constructor Details
-
PerthreadManagerImpl
-
-
Method Details
-
registerForShutdown
-
addThreadCleanupListener
Description copied from interface:PerthreadManager
Adds a listener to the hub. All listeners are discarded at thePerthreadManager.cleanup()
.- Specified by:
addThreadCleanupListener
in interfacePerthreadManager
- Parameters:
listener
- to add
-
addThreadCleanupCallback
Description copied from interface:PerthreadManager
Adds a callback to be invoked whenPerthreadManager.cleanup()
is invoked; callbacks are then removed.- Specified by:
addThreadCleanupCallback
in interfacePerthreadManager
-
cleanup
Instructs the hub to notify all its listeners (for the current thread). It also discards its list of listeners.- Specified by:
cleanup
in interfacePerthreadManager
-
createValue
Description copied from interface:PerthreadManager
ReturnObjectCreator
, which for each thread, the first call will use the delegateObjectCreator
to create an instance, and later calls will reuse the same per-thread instance. The instance is stored in thePerthreadManager
and will be released at the end of the request.- Specified by:
createValue
in interfacePerthreadManager
-
createValue
Description copied from interface:PerthreadManager
Creates a value using a unique internal key.- Specified by:
createValue
in interfacePerthreadManager
-
run
Description copied from interface:PerthreadManager
InvokesRunnable.run()
, providing a try...finally to cleanup after.- Specified by:
run
in interfacePerthreadManager
-
invoke
Description copied from interface:PerthreadManager
Returns the result from the invocation, providing a try...finally to cleanup after.- Specified by:
invoke
in interfacePerthreadManager
-