public void setTransportListener(TransportListener commandListener) { try { try { enqueueValve.turnOff(); this.transportListener = commandListener; wakeup(); } finally { enqueueValve.turnOn(); } } catch (InterruptedException e) { throw new RuntimeException(e); } }
public void start() throws Exception { if (transportListener == null) { throw new IOException("TransportListener not set."); } try { enqueueValve.turnOff(); if (messageQueue != null && !async) { Object command; while ((command = messageQueue.poll()) != null && !stopping.get() ) { receiveCounter++; dispatch(this, transportListener, command); } } started = true; wakeup(); } finally { enqueueValve.turnOn(); } // If we get stopped while starting up, then do the actual stop now // that the enqueueValve is back on. if( stopping.get() ) { stop(); } }
enqueueValve.turnOn();
dispatchValve.turnOn();
dispatchValve.turnOn();