geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
private void handOffNewClientConnection(final Socket socket,
      final ServerConnectionFactory serverConnectionFactory) {
    try {
      this.stats.incAcceptsInProgress();
      this.hsPool.execute(new Runnable() {
        public void run() {
          boolean finished = false;
          try {
            handleNewClientConnection(socket, serverConnectionFactory);
            finished = true;
          } catch (RegionDestroyedException rde) {
            // aborted due to disconnect - bug 42273
            if (rde.getMessage().indexOf("HARegion") == -1) {
              throw rde;
            }
          } catch (CancelException e) {
            // aborted due to shutdown - bug 37318
          } catch (java.nio.channels.AsynchronousCloseException expected) {
            // this is expected when our TimerTask times out an accepted socket
          } catch (IOException | ToDataException ex) { // added ToDataException to fix bug 44659
            if (isRunning()) {
              if (!AcceptorImpl.this.loggedAcceptError) {
                AcceptorImpl.this.loggedAcceptError = true;
                if (ex instanceof SocketTimeoutException) {
                  logger.warn(LocalizedMessage.create(
                      LocalizedStrings.AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION_DUE_TO_SOCKET_TIMEOUT));
                } else {
                  logger.warn(LocalizedMessage.create(
                      LocalizedStrings.AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION__0,
                      ex), ex);
                }
              }
            }
          } finally {
            if (!finished) {
              closeSocket(socket);
            }
            if (isRunning()) {
              AcceptorImpl.this.stats.decAcceptsInProgress();
            }
          }
        }
      });
    } catch (RejectedExecutionException rejected) {
      closeSocket(socket);
      if (isRunning()) {
        this.stats.decAcceptsInProgress();
        logger.warn(LocalizedMessage.create(LocalizedStrings.AcceptorImpl_UNEXPECTED, rejected));
      }
    }
  }
/**
   * Hand off a new client connection to the thread pool that processes handshakes. If all the
   * threads in this pool are busy then the hand off will block until a thread is available. This
   * blocking is good because it will throttle the rate at which we create new connections.
   */
Hand off a new client connection to the thread pool that processes handshakes. If all the
threads in this pool are busy then the hand off will block until a thread is available. This
blocking is good because it will throttle the rate at which we create new connections.
Hand off a new client connection to the thread pool that processes handshakes . If all the threads in this pool are busy then the hand off will block until a thread is available . This blocking is good because it will throttle the rate at which we create new connections .
private void handOffNewClientConnection(final Socket socket,
      final ServerConnectionFactory serverConnectionFactory) {
    try {
      this.stats.incAcceptsInProgress();
      this.hsPool.execute(new Runnable() {
        public void run() {
          boolean finished = false;
          try {
            handleNewClientConnection(socket, serverConnectionFactory);
            finished = true;
          } catch (RegionDestroyedException rde) {
            if (rde.getMessage().indexOf("HARegion") == -1) {
              throw rde;
            }
          } catch (CancelException e) {
          } catch (java.nio.channels.AsynchronousCloseException expected) {
          } catch (IOException | ToDataException ex) { 
            if (isRunning()) {
              if (!AcceptorImpl.this.loggedAcceptError) {
                AcceptorImpl.this.loggedAcceptError = true;
                if (ex instanceof SocketTimeoutException) {
                  logger.warn(LocalizedMessage.create(
                      LocalizedStrings.AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION_DUE_TO_SOCKET_TIMEOUT));
                } else {
                  logger.warn(LocalizedMessage.create(
                      LocalizedStrings.AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION__0,
                      ex), ex);
                }
              }
            }
          } finally {
            if (!finished) {
              closeSocket(socket);
            }
            if (isRunning()) {
              AcceptorImpl.this.stats.decAcceptsInProgress();
            }
          }
        }
      });
    } catch (RejectedExecutionException rejected) {
      closeSocket(socket);
      if (isRunning()) {
        this.stats.decAcceptsInProgress();
        logger.warn(LocalizedMessage.create(LocalizedStrings.AcceptorImpl_UNEXPECTED, rejected));
      }
    }
  }
private void handOffNewClientConnection ( final Socket socket , final ServerConnectionFactory serverConnectionFactory ) { try { this . stats . incAcceptsInProgress ( ) ; this . hsPool . execute ( new Runnable ( ) { public void run ( ) { boolean finished = false ; try { handleNewClientConnection ( socket , serverConnectionFactory ) ; finished = true ; } catch ( RegionDestroyedException rde ) { if ( rde . getMessage ( ) . indexOf ( "HARegion" ) == - 1 ) { throw rde ; } } catch ( CancelException e ) { } catch ( java . nio . channels . AsynchronousCloseException expected ) { } catch ( IOException | ToDataException ex ) { if ( isRunning ( ) ) { if ( ! AcceptorImpl . this . loggedAcceptError ) { AcceptorImpl . this . loggedAcceptError = true ; if ( ex instanceof SocketTimeoutException ) { logger . warn ( LocalizedMessage . create ( LocalizedStrings . AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION_DUE_TO_SOCKET_TIMEOUT ) ) ; } else { logger . warn ( LocalizedMessage . create ( LocalizedStrings . AcceptorImpl_CACHE_SERVER_FAILED_ACCEPTING_CLIENT_CONNECTION__0 , ex ) , ex ) ; } } } } finally { if ( ! finished ) { closeSocket ( socket ) ; } if ( isRunning ( ) ) { AcceptorImpl . this . stats . decAcceptsInProgress ( ) ; } } } } ) ; } catch ( RejectedExecutionException rejected ) { closeSocket ( socket ) ; if ( isRunning ( ) ) { this . stats . decAcceptsInProgress ( ) ; logger . warn ( LocalizedMessage . create ( LocalizedStrings . AcceptorImpl_UNEXPECTED , rejected ) ) ; } } }
Hand off a new client connection to the thread pool that processes handshakes.
Hand off a new client connection to the thread pool that processes handshakes .
// aborted due to disconnect - bug 42273 // aborted due to shutdown - bug 37318 // this is expected when our TimerTask times out an accepted socket // added ToDataException to fix bug 44659