예제 #1
0
 boolean isConnectionHealthy(long elapsed) {
   if (elapsed >= heartBeatInterval) {
     if (sendConnection != null) {
       return sendConnection.isHeartBeating();
     } else {
       return true;
     }
   }
   return true;
 }
  private boolean isAllowedToSendRequest(ClientConnection connection, ClientInvocation invocation) {
    if (!connection.isHeartBeating()) {
      if (invocation.shouldBypassHeartbeatCheck()) {
        // ping and removeAllListeners should be send even though heart is not beating
        return true;
      }

      if (logger.isFinestEnabled()) {
        logger.warning(
            "Connection is not heart-beating, won't write client message -> "
                + invocation.getClientMessage());
      }
      return false;
    }
    return true;
  }