Exemplo n.º 1
0
 /**
  * 登录是否成功成功开始心跳
  *
  * @param success
  */
 @Override
 public void login(boolean success) {
   synchronized (_monitor) {
     if (success && isActive()) {
       _status = Status.Service;
       _heartbeatKeep.start(this);
       heartbeatTouch();
     }
   }
 }
Exemplo n.º 2
0
  @Override
  public void close() throws IOException {
    synchronized (_monitor) {
      if (isClose()) {
        return;
      }

      if (isNew()) {
        _status = Status.Close;
        return;
      }

      logger.debug("{} start session close", _key.toString());
      logout();
      _status = Status.Close;
      _heartbeatKeep.shutdown();
      if (_channel != null && _channel.isOpen()) {
        _channel.close();
      }
      logger.debug("{} finish session close", _key.toString());
    }
  }