Пример #1
0
 private void run(long timeout) {
   startTime = System.currentTimeMillis();
   if (timeout > 0) {
     timerId = TimerManager.setTimeout(timeout, this, null);
   } else {
     timerId = TimerManager.INVALID_ID;
   }
   addWsClient();
 }
Пример #2
0
 @Override
 public void onWcMessage(Object userContext, String message) {
   if ("OK".equals(message)) {
     addWsClient();
     return;
   }
   long sendTime = Long.parseLong(message);
   long now = System.currentTimeMillis();
 }
Пример #3
0
 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;
   }
 }