|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread org.zkoss.zk.ui.impl.EventProcessingThreadImpl
public class EventProcessingThreadImpl
Thread to handle events.
We need to handle events in a separate thread, because it might
suspend (by calling UiEngine.wait(java.lang.Object)
), such as waiting
a modal dialog to complete.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
EventProcessingThreadImpl()
|
Method Summary | |
---|---|
void |
cease(java.lang.String cause)
Stops the thread. |
void |
ceaseSilently(java.lang.String cause)
Stops the thread silently. |
boolean |
doResume()
Resumes this thread and returns only if the execution (being suspended by doSuspend(java.lang.Object) ) completes. |
static void |
doSuspend(java.lang.Object mutex)
Suspends the current thread and Waits until doResume()
is called. |
Component |
getComponent()
Returns the component being processed by this thread, or null if idle. |
Event |
getEvent()
Returns the event being processed by this thread, or null if idle. |
static int |
getThreadNumber()
Returns the number of event threads. |
static int |
getThreadNumberInProcessing()
Returns the number of event threads in processing. |
boolean |
isCeased()
Returns whether it is ceased. |
boolean |
isIdle()
Returns whether this thread is idle, i.e., not processing any event. |
boolean |
isSuspended()
Returns whether it is suspended. |
void |
newEventThreadSuspends(java.lang.Object mutex)
Invokes Configuration.newEventThreadSuspends(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.lang.Object) . |
boolean |
processEvent(Desktop desktop,
Component comp,
Event event)
Ask this event thread to process the specified event. |
void |
run()
|
void |
sendEvent(Component comp,
Event event)
Sends the specified component and event and processes the event synchronously. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EventProcessingThreadImpl()
Method Detail |
---|
public boolean isCeased()
EventProcessingThread
The event processing thread is ceased automatically.
If you want to cease it manually, you can invoke
DesktopCtrl.ceaseSuspendedThread(org.zkoss.zk.ui.sys.EventProcessingThread, java.lang.String)
.
An event processing thread is ceased if DesktopCtrl.ceaseSuspendedThread(org.zkoss.zk.ui.sys.EventProcessingThread, java.lang.String)
was called manually, or if it is dead (Thread.isAlive()
returns false).
That is, it returns true if it is going to die, or dead already.
isCeased
in interface EventProcessingThread
public boolean isSuspended()
EventProcessingThread
isSuspended
in interface EventProcessingThread
DesktopCtrl.getSuspendedThreads()
,
DesktopCtrl.ceaseSuspendedThread(org.zkoss.zk.ui.sys.EventProcessingThread, java.lang.String)
public boolean isIdle()
EventProcessingThread
isIdle
in interface EventProcessingThread
public final Event getEvent()
EventProcessingThread
getEvent
in interface EventProcessingThread
public final Component getComponent()
EventProcessingThread
getComponent
in interface EventProcessingThread
public void sendEvent(Component comp, Event event) throws java.lang.Exception
EventProcessingThread
Events.sendEvent(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)
.
sendEvent
in interface EventProcessingThread
java.lang.Exception
public void cease(java.lang.String cause)
UiEngine
when it is stopping.
Application developers shall use DesktopCtrl.ceaseSuspendedThread(org.zkoss.zk.ui.sys.EventProcessingThread, java.lang.String)
instead.
cause
- a human readable text describing the cause.
If null, an empty string is assumed.public void ceaseSilently(java.lang.String cause)
UiEngine
to stop abnormally.
public static final int getThreadNumber()
public static final int getThreadNumberInProcessing()
public static void doSuspend(java.lang.Object mutex) throws java.lang.InterruptedException
doResume()
is called.
Note:
UiEngine
Don't call it directly.
newEventThreadSuspends(java.lang.Object)
before calling this method. (Reason: UiEngine might have to store some info
after newEventThreadSuspends(java.lang.Object)
is called.
EventProcessingThreadImpl
.
java.lang.InterruptedException
public boolean doResume() throws java.lang.InterruptedException
doSuspend(java.lang.Object)
) completes.
It executes in the main thread (i.e., the servlet thread).
java.lang.InterruptedException
public boolean processEvent(Desktop desktop, Component comp, Event event)
Used internally to implement UiEngine
.
Application developers
shall use Events.sendEvent(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)
instead.
public void newEventThreadSuspends(java.lang.Object mutex)
Configuration.newEventThreadSuspends(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.lang.Object)
.
The caller must execute in the event processing thread.
It is called only for implementing UiEngine
.
Don't call it directly.
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public java.lang.String toString()
toString
in class java.lang.Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |