Class PerthreadManagerImpl
java.lang.Object
org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl
- All Implemented Interfaces:
PerthreadManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddThreadCleanupCallback(Runnable callback) Adds a callback to be invoked whenPerthreadManager.cleanup()is invoked; callbacks are then removed.voidAdds a listener to the hub.voidcleanup()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 delegateObjectCreatorto create an instance, and later calls will reuse the same per-thread instance.<T> TReturns the result from the invocation, providing a try...finally to cleanup after.voidvoidInvokesRunnable.run(), providing a try...finally to cleanup after.
-
Constructor Details
-
PerthreadManagerImpl
-
-
Method Details
-
registerForShutdown
-
addThreadCleanupListener
Description copied from interface:PerthreadManagerAdds a listener to the hub. All listeners are discarded at thePerthreadManager.cleanup().- Specified by:
addThreadCleanupListenerin interfacePerthreadManager- Parameters:
listener- to add
-
addThreadCleanupCallback
Description copied from interface:PerthreadManagerAdds a callback to be invoked whenPerthreadManager.cleanup()is invoked; callbacks are then removed.- Specified by:
addThreadCleanupCallbackin interfacePerthreadManager
-
cleanup
Instructs the hub to notify all its listeners (for the current thread). It also discards its list of listeners.- Specified by:
cleanupin interfacePerthreadManager
-
createValue
Description copied from interface:PerthreadManagerReturnObjectCreator, which for each thread, the first call will use the delegateObjectCreatorto create an instance, and later calls will reuse the same per-thread instance. The instance is stored in thePerthreadManagerand will be released at the end of the request.- Specified by:
createValuein interfacePerthreadManager
-
createValue
Description copied from interface:PerthreadManagerCreates a value using a unique internal key.- Specified by:
createValuein interfacePerthreadManager
-
run
Description copied from interface:PerthreadManagerInvokesRunnable.run(), providing a try...finally to cleanup after.- Specified by:
runin interfacePerthreadManager
-
invoke
Description copied from interface:PerthreadManagerReturns the result from the invocation, providing a try...finally to cleanup after.- Specified by:
invokein interfacePerthreadManager
-