AprEndpoint.Poller (Apache Tomcat 7.0.104 API Documentation)

org.apache.tomcat.util.net

## Class AprEndpoint.Poller

- java.lang.Object
- - org.apache.tomcat.util.net.AprEndpoint.Poller

- All Implemented Interfaces:
    Runnable
  Enclosing class:
    AprEndpoint

      public class AprEndpoint.Poller
      extends Object
      implements Runnable

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AprEndpoint.SocketList` | `addList` List of sockets to be added to the poller.
    `protected long[]` | `desc` Socket descriptors.
    `protected long` | `lastMaintain` Last run of maintain.
    `protected long` | `pool` Root pool.
    `protected AprEndpoint.SocketTimeouts` | `timeouts` Structure used for storing timeouts.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AprEndpoint.Poller()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(long socket, int timeout, boolean read, boolean write)` Add specified socket and associated pool to the poller.
    `protected boolean` | `addToPoller(long socket, int events)` Add specified socket to one of the pollers.
    `protected boolean` | `close(long socket)`
    `protected void` | `destroy()` Destroy the poller.
    `int` | `getConnectionCount()`
    `protected void` | `init()` Create the poller.
    `protected void` | `maintain()` Timeout checks.
    `void` | `run()` The background thread that adds sockets to the Poller, checks the poller for triggered events and hands the associated socket off to an appropriate processor as events occur.
    `protected void` | `stop()`
    `String` | `toString()` Displays the list of sockets in the pollers.

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

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

- - ### Field Detail

    - #### pool

          protected long pool

      Root pool.

    - #### desc

          protected long[] desc

      Socket descriptors.

    - #### addList

          protected AprEndpoint.SocketList addList

      List of sockets to be added to the poller.

    - #### timeouts

          protected AprEndpoint.SocketTimeouts timeouts

      Structure used for storing timeouts.

    - #### lastMaintain

          protected long lastMaintain

      Last run of maintain. Maintain will run approximately once every one second (may be slightly longer between runs).

  - ### Constructor Detail

    - #### AprEndpoint.Poller

          public AprEndpoint.Poller()

  - ### Method Detail

    - #### getConnectionCount

          public int getConnectionCount()

    - #### init

          protected void init()

      Create the poller.

    - #### stop

          protected void stop()

    - #### destroy

          protected void destroy()

      Destroy the poller.

    - #### add

          public void add(long socket,
                 int timeout,
                 boolean read,
                 boolean write)

      Add specified socket and associated pool to the poller. The socket will be added to a temporary array, and polled first after a maximum amount of time equal to pollTime (in most cases, latency will be much lower, however). Note: If both read and write are false, the socket will only be checked for timeout; if the socket was already present in the poller, a callback event will be generated and the socket will be removed from the poller.
      Parameters:
        `socket` - to add to the poller
        `timeout` - to use for this connection
        `read` - to do read polling
        `write` - to do write polling

    - #### addToPoller

          protected boolean addToPoller(long socket,
                            int events)

      Add specified socket to one of the pollers. Must only be called from `run()`.

    - #### close

          protected boolean close(long socket)

    - #### maintain

          protected void maintain()

      Timeout checks.

    - #### toString

          public String toString()

      Displays the list of sockets in the pollers.
      Overrides:
        `toString` in class `Object`

    - #### run

          public void run()

      The background thread that adds sockets to the Poller, checks the poller for triggered events and hands the associated socket off to an appropriate processor as events occur.
      Specified by:
        `run` in interface `Runnable`

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