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(); } } } }
public void reconnect() { LOG.debug("Waking up reconnect task"); try { reconnectTask.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }