private void run(long timeout) { startTime = System.currentTimeMillis(); if (timeout > 0) { timerId = TimerManager.setTimeout(timeout, this, null); } else { timerId = TimerManager.INVALID_ID; } addWsClient(); }
@Override public void onWcMessage(Object userContext, String message) { if ("OK".equals(message)) { addWsClient(); return; } long sendTime = Long.parseLong(message); long now = System.currentTimeMillis(); }
private synchronized void delWsClient(WsClientHandler wsClientHandler, boolean isFail) { clients.remove(wsClientHandler); wsClientHandler.unref(); int size = clients.size(); if (isFail) { failCount++; if (failCount >= maxFailCount) { publish(size, failCount, false); stop(); return; } } switch (stat) { case INC: addWsClient(); break; case DEC: if ((size % 100) == 0) { publish(size, failCount, false); } sendStop(); break; } }