public void dispatchAsync(Command message) {
   if (!stopping.get()) {
     if (taskRunner == null) {
       dispatchSync(message);
     } else {
       synchronized (dispatchQueue) {
         dispatchQueue.add(message);
       }
       try {
         taskRunner.wakeup();
       } catch (InterruptedException e) {
         Thread.currentThread().interrupt();
       }
     }
   } else {
     if (message.isMessageDispatch()) {
       MessageDispatch md = (MessageDispatch) message;
       TransmitCallback sub = md.getTransmitCallback();
       protocolManager.postProcessDispatch(md);
       if (sub != null) {
         sub.onFailure();
       }
     }
   }
 }
Ejemplo n.º 2
0
 public void reconnect() {
   LOG.debug("Waking up reconnect task");
   try {
     reconnectTask.wakeup();
   } catch (InterruptedException e) {
     Thread.currentThread().interrupt();
   }
 }