The org.zkoss.zk.ui.event.EventThreadCleanup interface"

From Documentation
m (correct highlight (via JWB))
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
  {{ZKConfigurationReferencePageHeader}}
 
  {{ZKConfigurationReferencePageHeader}}
'''Property:'''
 
The org.zkoss.zk.ui.event.EventThreadCleanup interface
 
  
<javadoc type="interface">org.zkoss.zk.ui.event.EventThreadCleanup</javadoc> is implemented by a listener class that will be used to cleanup an event processing thread, after it has processed an event.
+
'''Listener:'''
 +
org.zkoss.zk.ui.event.EventThreadCleanup
  
If a listener implements this interface, an instance is created, and then the <tt>cleanup</tt> method is called in the event processing thread after the thread processes the event. Then, the <tt>complete</tt> method is called in the main thread (aka., the servlet thread), after the main thread is resumed.
+
A listener could implement <javadoc type="interface">org.zkoss.zk.ui.event.EventThreadCleanup</javadoc> to cleanup an event processing thread, after it has processed an event.
  
'''Note''': The <tt>complete</tt> method won't be called if the corresponding <tt>cleanup</tt> method threw an exception.
+
<blockquote>
 +
----
 +
Notice that it is useless unless [[ZK Developer's Reference/UI Patterns/Event Threads|the event processing threads]] are enabled (it is disabled by default).
 +
</blockquote>
 +
 
 +
If a listener implements this interface, an instance is created, and then the <code>cleanup</code> method is called in the event processing thread after the thread processes the event. Then, the <code>complete</code> method is called in the main thread (aka., the servlet thread), after the main thread is resumed.
 +
 
 +
'''Note''': The <code>complete</code> method won't be called if the corresponding <code>cleanup</code> method threw an exception.
  
 
A typical use of this feature is to clean up unclosed transaction.
 
A typical use of this feature is to clean up unclosed transaction.
  
Once registered, an instance is constructed and the <tt>cleanup</tt> method is called after leaving the event processing thread.
+
Once registered, an instance is instantiated and the <code>cleanup</code> method is called after leaving the event processing thread.
 +
 
 +
'''Instantiation:'''
 +
An independent instance of the given class is instantiated each time before the method is invoked. It means it is thread safe, and all information stored in non-static members will be lost after called.
  
{{ZKConfigurationReferencePageFooter}}
+
{{ZKConfigurationReferencePageFooter}}

Latest revision as of 10:23, 19 January 2022


DocumentationZK Configuration Referencezk.xmlThe listener ElementThe org.zkoss.zk.ui.event.EventThreadCleanup interface
The org.zkoss.zk.ui.event.EventThreadCleanup interface


Listener:

org.zkoss.zk.ui.event.EventThreadCleanup

A listener could implement EventThreadCleanup to cleanup an event processing thread, after it has processed an event.


Notice that it is useless unless the event processing threads are enabled (it is disabled by default).

If a listener implements this interface, an instance is created, and then the cleanup method is called in the event processing thread after the thread processes the event. Then, the complete method is called in the main thread (aka., the servlet thread), after the main thread is resumed.

Note: The complete method won't be called if the corresponding cleanup method threw an exception.

A typical use of this feature is to clean up unclosed transaction.

Once registered, an instance is instantiated and the cleanup method is called after leaving the event processing thread.

Instantiation: An independent instance of the given class is instantiated each time before the method is invoked. It means it is thread safe, and all information stored in non-static members will be lost after called.



Last Update : 2022/01/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.