SocketEvent (Apache Tomcat 9.0.75 API Documentation)

Package org.apache.tomcat.util.net

## Enum SocketEvent

- java.lang.Object
- - java.lang.Enum<SocketEvent>
  - - org.apache.tomcat.util.net.SocketEvent

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Comparable<SocketEvent>`

      public enum SocketEvent
      extends java.lang.Enum<SocketEvent>

  Defines events that occur per socket that require further processing by the container. Usually these events are triggered by the socket implementation but they may be triggered by the container.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant | Description
    --- | ---
    `CONNECT_FAIL` | A client attempted to establish a connection but failed.
    `DISCONNECT` | The client has disconnected.
    `ERROR` | An error has occurred on a non-container thread and processing needs to return to the container for any necessary clean-up.
    `OPEN_READ` | Data is available to be read.
    `OPEN_WRITE` | The socket is ready to be written to.
    `STOP` | The associated Connector/Endpoint is stopping and the connection/socket needs to be closed cleanly.
    `TIMEOUT` | A timeout has occurred and the connection needs to be closed cleanly.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SocketEvent` | `valueOf​(java.lang.String name)` | Returns the enum constant of this type with the specified name.
    `static SocketEvent[]` | `values()` | Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### OPEN_READ

          public static final SocketEvent OPEN_READ

      Data is available to be read.

    - #### OPEN_WRITE

          public static final SocketEvent OPEN_WRITE

      The socket is ready to be written to.

    - #### STOP

          public static final SocketEvent STOP

      The associated Connector/Endpoint is stopping and the connection/socket needs to be closed cleanly.

    - #### TIMEOUT

          public static final SocketEvent TIMEOUT

      A timeout has occurred and the connection needs to be closed cleanly. Currently this is only used by the Servlet 3.0 async processing.

    - #### DISCONNECT

          public static final SocketEvent DISCONNECT

      The client has disconnected.

    - #### ERROR

          public static final SocketEvent ERROR

      An error has occurred on a non-container thread and processing needs to return to the container for any necessary clean-up. Examples of where this is used include:
      - by NIO2 to signal the failure of a completion handler
      - by the container to signal an I/O error on a non-container thread during Servlet 3.0 asynchronous processing.

    - #### CONNECT_FAIL

          public static final SocketEvent CONNECT_FAIL

      A client attempted to establish a connection but failed. Examples of where this is used include:
      - TLS handshake failures

  - ### Method Detail

    - #### values

          public static SocketEvent[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (SocketEvent c : SocketEvent.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static SocketEvent valueOf​(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null