/** Wakes up a single event processing thread that is waiting on the * specified object. * * <p>Unlike {@link #notify(Desktop, Object)}, this method can be invoked only * in the event listener that processing the same desktop. * In addition, this method can be called under the event listener. * * <p>Use {@link #notify(Desktop, Object)} if you want to notify in other * thread, such as a working thread. * * @param mutex any non-null object to identify what to notify. * It must be same object passed to {@link #wait}. * If there is racing issue, you have to enclose it with * <code>synchronized</code> (though it is optional). * @see #notify(Desktop, Object) * @see #notifyAll(Object) * @exception UiException if it is called not during event processing. */ public static final void notify(Object mutex) { getUiEngine().notify(mutex); }
/** Wakes up all event processing thread that are waiting on the * specified object. * * <p>Unlike {@link #notify(Desktop, Object)}, this method can be invoked only * in the event listener that processing the same desktop. * In addition, this method can be called under the event listener. * * <p>Use {@link #notifyAll(Desktop, Object)} if you want to notify in other * thread, such as a working thread. * * @param mutex any non-null object to identify what to notify. * It must be same object passed to {@link #wait}. * If there is racing issue, you have to enclose it with * <code>synchronized</code> (though it is optional). * @see #notify(Desktop, Object) * @see #notifyAll(Object) * @exception UiException if it is called not during event processing. */ public static final void notifyAll(Object mutex) { getUiEngine().notifyAll(mutex); }
/** Suspends the current processing of an event and wait until the * other thread invokes {@link #notify(Object)}, {@link #notifyAll(Object)}, * {@link #notify(Desktop, Object)} or {@link #notifyAll(Desktop, Object)} * for the specified object. * * <p>It can only be called when the current thread is processing an event. * And, when called, the current processing is suspended and ZK continues * to process the next event and finally render the result. * * <p>It is typical use to implement a modal dialog where it won't return * until the modal dialog ends. * * @param mutex any non-null object to identify what to notify. * It must be same object passed to {@link #notify(Desktop, Object)}. * If there is racing issue, you have to enclose it with * <code>synchronized</code> (though it is optional). * @exception UiException if it is called not during event processing. * @exception SuspendNotAllowedException if there are too many suspended * exceptions. * Deployers can control the maximal allowed number of suspended exceptions * by specifying <code>max-suspended-thread</code> in <code>zk.xml</code>, * or invoking {@link org.zkoss.zk.ui.util.Configuration#setMaxSuspendedThreads}. */ public static final void wait(Object mutex) throws InterruptedException, SuspendNotAllowedException { getUiEngine().wait(mutex); }
getUiEngine(desktop).notifyAll(desktop, mutex);
getUiEngine(desktop).notify(desktop, mutex);