Code example for Selector

Methods: wakeup

0
 
    /** 
     * If the selector is blocked, wake it up. 
     */ 
    public void wakeupSelector() { 
      selector.wakeup();
    } 
 
    /** 
     * Add FrameBuffer to the list of select interest changes and wake up the 
     * selector if it's blocked. When the select() call exits, it'll give the 
     * FrameBuffer a chance to change its interests. 
     */ 
    public void requestSelectInterestChange(FrameBuffer frameBuffer) {
      synchronized (selectInterestChanges) {
        selectInterestChanges.add(frameBuffer);
      } 
      // wakeup the selector, if it's currently blocked. 
      selector.wakeup();
    }