org.apache.tomcat.util.net

## Class Acceptor<U>

- java.lang.Object
- - org.apache.tomcat.util.net.Acceptor<U>

- All Implemented Interfaces:
    Runnable
  Direct Known Subclasses:
    Nio2Endpoint.Nio2Acceptor

      public class Acceptor<U>
      extends Object
      implements Runnable

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Acceptor.AcceptorState`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Acceptor.AcceptorState` | `state`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Acceptor(AbstractEndpoint<?,U> endpoint)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Acceptor.AcceptorState` | `getState()`
    `protected int` | `handleExceptionWithDelay(int currentErrorDelay)` Handles exceptions where a delay is required to prevent a Thread from entering a tight loop which will consume CPU and may also trigger large amounts of logging.
    `void` | `run()`
    `void` | `stop()` Deprecated. This method will be removed in Tomcat 10.1.x onwards. Use `stop(int)` instead.
    `void` | `stop(int waitSeconds)` Signals the Acceptor to stop, optionally waiting for that stop process to complete before returning.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### state

          protected volatile Acceptor.AcceptorState state

  - ### Constructor Detail

    - #### Acceptor

          public Acceptor(AbstractEndpoint<?,U> endpoint)

  - ### Method Detail

    - #### getState

          public final Acceptor.AcceptorState getState()

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### stop

          @Deprecated
          public void stop()

      Deprecated. This method will be removed in Tomcat 10.1.x onwards. Use `stop(int)` instead.
      Signals the Acceptor to stop, waiting at most 10 seconds for the stop to complete before returning. If the stop does not complete in that time a warning will be logged.

    - #### stop

          public void stop(int waitSeconds)

      Signals the Acceptor to stop, optionally waiting for that stop process to complete before returning. If a wait is requested and the stop does not complete in that time a warning will be logged.
      Parameters:
        `waitSeconds` - The time to wait in seconds. Use a value less than zero for no wait.

    - #### handleExceptionWithDelay

          protected int handleExceptionWithDelay(int currentErrorDelay)

      Handles exceptions where a delay is required to prevent a Thread from entering a tight loop which will consume CPU and may also trigger large amounts of logging. For example, this can happen if the ulimit for open files is reached.
      Parameters:
        `currentErrorDelay` - The current delay being applied on failure
      Returns:
        The delay to apply on the next failure

Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.