private void handleReadTimeout(final long ret) throws IOException {
   if (!connection.isOpen()) {
     cleanup();
     return;
   }
   if (ret == -1) {
     cleanup();
     return;
   }
   if (ret == 0 && handle != null) {
     return;
   }
   Integer timeout = getTimeout();
   if (timeout == null || timeout <= 0) {
     return;
   }
   long currentTime = System.currentTimeMillis();
   long expireTimeVar = expireTime;
   if (expireTimeVar != -1 && currentTime > expireTimeVar) {
     IoUtils.safeClose(connection);
     throw new ClosedChannelException();
   }
   expireTime = currentTime + timeout;
 }
 public boolean isOpen() {
   return channel.isOpen();
 }
 @Override
 public boolean isActive() {
   StreamConnection conn = connection();
   return conn != null && conn.isOpen() && !closed;
 }
Пример #4
0
 @Override
 public boolean isOpen() {
   return connection.isOpen() && allAreClear(state, CLOSE_REQ | CLOSED);
 }
 @Override
 public boolean isOpen() {
   StreamConnection conn = connection();
   return (conn == null || conn.isOpen()) && !closed;
 }