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; }
public void signalLoopbreak() { loopBreaker.set(true); if (mySelector != null) mySelector.wakeup(); }
void runLoopbreaks() { if (loopBreaker.getAndSet(false)) { eventCallback(0, EM_LOOPBREAK_SIGNAL, null); } }