EventQueue
is a platform-independent class that queues events, both from the underlying peer classes and from trusted application classes. It encapsulates asynchronous event dispatch machinery which extracts events from the queue and dispatches them by calling {@link #dispatchEvent(AWTEvent) dispatchEvent(AWTEvent)} methodon this EventQueue
with the event to be dispatched as an argument. The particular behavior of this machinery is implementation-dependent. The only requirements are that events which were actually enqueued to this queue (note that events being posted to the EventQueue
can be coalesced) are dispatched:
AWTEvent
A is enqueued to the EventQueue
before AWTEvent
B then event B will not be dispatched before event A. Some browsers partition applets in different code bases into separate contexts, and establish walls between these contexts. In such a scenario, there will be one EventQueue
per context. Other browsers place all applets into the same context, implying that there will be only a single, global EventQueue
for all applets. This behavior is implementation-dependent. Consult your browser's documentation for more information.
For information on the threading issues of the event dispatch machinery, see AWT Threading Issues. @author Thomas Ball @author Fred Ecks @author David Mendenhall @since 1.1
SyncEvents are enqueued with a lower priority than other events, and if multiple SyncEvents are found on the queue they are coalesced into a single SyncEvent.
Some events cause the suspension of the target VM - event requests ( {@link com.sun.jdi.request}) with a {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}of {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL}or {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD SUSPEND_EVENT_THREAD} and sometimes{@link VMStartEvent}. If these suspensions are not resumed the target VM will hang. Thus, it is always good policy to {@link #remove() remove()} every EventSet from theevent queue until an EventSet containing a {@link VMDisconnectEvent} is read.Unless {@link com.sun.jdi.VirtualMachine#resume() resume} isbeing handled in another way, each EventSet should invoke {@link EventSet#resume()}. @see EventSet @see VirtualMachine @author Robert Field @since 1.3
EventQueue
is a platform-independent class that queues events, both from the underlying peer classes and from trusted application classes. It encapsulates asynchronous event dispatch machinery which extracts events from the queue and dispatches them by calling {@link #dispatchEvent(AWTEvent) dispatchEvent(AWTEvent)} methodon this EventQueue
with the event to be dispatched as an argument. The particular behavior of this machinery is implementation-dependent. The only requirements are that events which were actually enqueued to this queue (note that events being posted to the EventQueue
can be coalesced) are dispatched:
AWTEvent
A is enqueued to the EventQueue
before AWTEvent
B then event B will not be dispatched before event A. Some browsers partition applets in different code bases into separate contexts, and establish walls between these contexts. In such a scenario, there will be one EventQueue
per context. Other browsers place all applets into the same context, implying that there will be only a single, global EventQueue
for all applets. This behavior is implementation-dependent. Consult your browser's documentation for more information.
For information on the threading issues of the event dispatch machinery, see AWT Threading Issues. @author Thomas Ball @author Fred Ecks @author David Mendenhall @version 1.105, 07/11/06 @since 1.1
There are two kinds of event listeners: synchronous and asynchronous. A synchronous listener works the same as a normal event listener (listeners registered to a component ( {@link org.zkoss.zk.ui.Component#addEventListener}). It is executed one-by-one. No two event listeners belonging to the same desktop will be executed at the same time. In additions, it is invoked under an execution (i.e., {@link org.zkoss.zk.ui.Executions#getCurrent} never null).It is allowed to manipulate the components belonging to the current execution.
On the other hand, an asynchronous listener is executed asynchronously in another thread. It can not access the components belonging to any desktop. There is no current execution ( {@link org.zkoss.zk.ui.Executions#getCurrent} is null}.However, it is useful to make the application more responsive when executing a long operation. A typical use is to execute the long operation in an asynchronous listener, and then all other events can be processed concurrently. @author tomyeh @since 5.0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|