Interface EventThreadInit


public interface EventThreadInit
Used to initialize the event processing thread.

How this interface is used.

  1. First, you specify a class that implements this interface in WEB-INF/zk.xml as a listener.
  2. Then, even time the engine (in the main thread) is about to process an event, it creates a new instance of the specified class, invokes prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event), and then pass it to the thread processing thread.
  3. After the thread processing thread is resumed, it invokes init(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) to do the initialization.

In other words, prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) is called in the servlet thread, while init(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) is called in the event processing thread. Therefore, the typical use is retrieving thread-relevant info in prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event), and then apply them in the event processing thread when init(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) is called.

Author:
tomyeh
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    init(Component comp, Event event)
    Initialize the event processing thread before processing the event.
    void
    prepare(Component comp, Event event)
    Prepares the initialization at the servlet thread.