Пример #1
0
  public EmReactor() {
    Timers = new TreeMap<Long, ArrayList<Long>>();
    Connections = new HashMap<Long, EventableChannel>();
    Acceptors = new HashMap<Long, ServerSocketChannel>();
    NewConnections = new ArrayList<Long>();
    UnboundConnections = new ArrayList<Long>();
    DetachedConnections = new ArrayList<EventableSocketChannel>();

    BindingIndex = 0;
    loopBreaker = new AtomicBoolean();
    loopBreaker.set(false);
    myReadBuffer =
        ByteBuffer.allocate(
            32 * 1024); // don't use a direct buffer. Ruby doesn't seem to like them.
    timerQuantum = 98;
  }
Пример #2
0
 public void signalLoopbreak() {
   loopBreaker.set(true);
   if (mySelector != null) mySelector.wakeup();
 }
Пример #3
0
 void runLoopbreaks() {
   if (loopBreaker.getAndSet(false)) {
     eventCallback(0, EM_LOOPBREAK_SIGNAL, null);
   }
 }