public interface EventThreadCleanup
How this interface is used.
cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>)
is invoked when the event processing thread has processed an event,
and then complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)
of the same instance is called in the servlet
thread.Thus, the typical use is to cleanup un-closed transactions
when cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>)
is called.
Modifier and Type | Method and Description |
---|---|
void |
cleanup(Component comp,
Event evt,
java.util.List<java.lang.Throwable> errs)
Cleans up the event processing thread.
|
void |
complete(Component comp,
Event evt)
Called in the serlvet thread to clean up.
|
void cleanup(Component comp, Event evt, java.util.List<java.lang.Throwable> errs) throws java.lang.Exception
If this method threw an exception and errs is empty, the exception will be propagated back to the servlet thread and then reported to the user.
Note: cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>)
is called first in the event processing thread,
and then complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)
is called in the servlet thread.
Note: complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)
of an EventThreadCleanup
instance is called
only if cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>)
called against the same instance
didn't throw any exception.
If the use of the event thread is disabled
(Configuration.isEventThreadEnabled()
returns false), this method is also invoked in the Servlet thread.
errs
- a list of exceptions (java.lang.Throwable) if any exception
occurred before this method is called, or null if no exception at all.
Note: you can manipulate the list directly to add or clean up exceptions.
For example, if exceptions are fixed correctly, you can call errs.clear()
such that no error message will be displayed at the client.java.lang.Exception
void complete(Component comp, Event evt) throws java.lang.Exception
cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>)
is called.
Note: cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>)
is called first in the event processing thread,
and then complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)
is called in the servlet thread.
java.lang.Exception
Copyright © 2005-2023 Potix Corporation. All Rights Reserved.