Class EventProcessingThreadImpl
- All Implemented Interfaces:
Runnable,EventProcessingThread
UiEngine.wait(java.lang.Object)), such as waiting
a modal dialog to complete.- Author:
- tomyeh
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidStops the thread.voidceaseSilently(String cause) Stops the thread silently.booleandoResume()Resumes this thread and returns only if the execution (being suspended bydoSuspend(java.lang.Object)) completes.static voidSuspends the current thread and Waits untildoResume()is called.final ComponentReturns the component being processed by this thread, or null if idle.final EventgetEvent()Returns the event being processed by this thread, or null if idle.static final intReturns the number of event threads.static final intReturns the number of event threads in processing.booleanisCeased()Returns whether it is ceased.booleanisIdle()Returns whether this thread is idle, i.e., not processing any event.booleanReturns whether it is suspended.voidnewEventThreadSuspends(Object mutex) booleanprocessEvent(Desktop desktop, Component comp, Event event) Ask this event thread to process the specified event.voidrun()voidSends the specified component and event and processes the event synchronously.toString()Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
Constructor Details
-
EventProcessingThreadImpl
public EventProcessingThreadImpl()
-
-
Method Details
-
isCeased
public boolean isCeased()Description copied from interface:EventProcessingThreadReturns whether it is ceased.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.- Specified by:
isCeasedin interfaceEventProcessingThread
-
isSuspended
public boolean isSuspended()Description copied from interface:EventProcessingThreadReturns whether it is suspended.- Specified by:
isSuspendedin interfaceEventProcessingThread- See Also:
-
isIdle
public boolean isIdle()Description copied from interface:EventProcessingThreadReturns whether this thread is idle, i.e., not processing any event.- Specified by:
isIdlein interfaceEventProcessingThread
-
getEvent
Description copied from interface:EventProcessingThreadReturns the event being processed by this thread, or null if idle.- Specified by:
getEventin interfaceEventProcessingThread
-
getComponent
Description copied from interface:EventProcessingThreadReturns the component being processed by this thread, or null if idle.- Specified by:
getComponentin interfaceEventProcessingThread
-
sendEvent
Description copied from interface:EventProcessingThreadSends the specified component and event and processes the event synchronously. Used to implementsEvents.sendEvent(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event).- Specified by:
sendEventin interfaceEventProcessingThread- Throws:
Exception
-
cease
Stops the thread. Called only byUiEnginewhen it is stopping.Application developers shall use
DesktopCtrl.ceaseSuspendedThread(org.zkoss.zk.ui.sys.EventProcessingThread, java.lang.String)instead.- Parameters:
cause- a human readable text describing the cause. If null, an empty string is assumed.
-
ceaseSilently
Stops the thread silently. Called byUiEngineto stop abnormally. -
getThreadNumber
public static final int getThreadNumber()Returns the number of event threads. -
getThreadNumberInProcessing
public static final int getThreadNumberInProcessing()Returns the number of event threads in processing. -
doSuspend
Suspends the current thread and Waits untildoResume()is called.Note:
- It is used internally only for implementing
UiEngineDon't call it directly. - Caller must invoke
newEventThreadSuspends(java.lang.Object)before calling this method. (Reason: UiEngine might have to store some info afternewEventThreadSuspends(java.lang.Object)is called. - The current thread must be
EventProcessingThreadImpl. - It is a static method.
- Throws:
InterruptedException
- It is used internally only for implementing
-
doResume
Resumes this thread and returns only if the execution (being suspended bydoSuspend(java.lang.Object)) completes.It executes in the main thread (i.e., the servlet thread).
- Returns:
- whether the event has been processed completely or just be suspended
- Throws:
InterruptedException
-
processEvent
Ask this event thread to process the specified event.Used internally to implement
UiEngine. Application developers shall useEvents.sendEvent(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)instead.- Returns:
- whether the event has been processed completely or just be suspended. Recycle it only if true is returned.
-
newEventThreadSuspends
InvokesConfiguration.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 implementingUiEngine. Don't call it directly. -
run
public void run() -
toString
-