The org.zkoss.zk.ui.event.EventThreadResume interface"
Line 1: | Line 1: | ||
{{ZKConfigurationReferencePageHeader}} | {{ZKConfigurationReferencePageHeader}} | ||
'''Property:''' | '''Property:''' | ||
− | + | org.zkoss.zk.ui.event.EventThreadResume interface | |
<javadoc type="interface">org.zkoss.zk.ui.event.EventThreadResume</javadoc> is implemented by a listener class that will be called after an event processing thread is resumed or aborted. | <javadoc type="interface">org.zkoss.zk.ui.event.EventThreadResume</javadoc> is implemented by a listener class that will be called after an event processing thread is resumed or aborted. |
Revision as of 02:20, 7 December 2010
Property:
org.zkoss.zk.ui.event.EventThreadResume interface
EventThreadResume is implemented by a listener class that will be called after an event processing thread is resumed or aborted.
If a listener implements this interface, an instance is created, and then the beforeResume method is called in the main thread (aka., the servlet thread), when a suspended event thread is being resumed. Then, the afterResume method is called in the event processing thread after the thread is resumed successfully.
If a developer wants to prevent an event from being resumed, he can throw an exception in the beforeResume method.
Notice that beforeResume executes in the main thread, so it shares the same thread-local storage with the main thread. On the other hand, afterResume executes in the event processing thread, so it shares the same thread-local storage with the event thread (and application event listeners).
In additions to resuming normally, a suspended event processing thread might be aborted abnormally. For example, when the desktop is being destroyed, all suspended event threads will be aborted. When the suspended event processing thread is aborted, an instance is created, and the abortResume method is called in the main thread.
Note: If a suspended event thread is aborted, none of the beforeResume and afterResume is called. Moreover, the cleanup and complete methods of EventThreadCleanup won't be called, either. Thus, you have to handle all necessary cleanups in abortResume.