org.apache.tomcat.util.net

## Class NioEndpoint.Poller

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

- All Implemented Interfaces:
    Runnable
  Enclosing class:
    NioEndpoint

      public class NioEndpoint.Poller
      extends Object
      implements Runnable

  Poller class.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NioEndpoint.Poller()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(NioChannel socket, int interestOps)` Add specified socket and associated pool to the poller.
    `NioEndpoint.NioSocketWrapper` | `cancelledKey(SelectionKey key)`
    `protected void` | `destroy()` Destroy the poller.
    `boolean` | `events()` Processes events in the event queue of the Poller.
    `int` | `getKeyCount()`
    `Selector` | `getSelector()`
    `protected void` | `processKey(SelectionKey sk, NioEndpoint.NioSocketWrapper attachment)`
    `SendfileState` | `processSendfile(SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, boolean calledByProcessor)`
    `protected void` | `reg(SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, int intops)`
    `void` | `register(NioChannel socket)` Registers a newly created socket with the poller.
    `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` | `timeout(int keyCount, boolean hasEvents)`
    `protected void` | `unreg(SelectionKey sk, NioEndpoint.NioSocketWrapper socketWrapper, int readyOps)`

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

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

- - ### Constructor Detail

    - #### NioEndpoint.Poller

          public NioEndpoint.Poller()
                             throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### getKeyCount

          public int getKeyCount()

    - #### getSelector

          public Selector getSelector()

    - #### destroy

          protected void destroy()

      Destroy the poller.

    - #### add

          public void add(NioChannel socket,
                 int interestOps)

      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).
      Parameters:
        `socket` - to add to the poller
        `interestOps` - Operations for which to register this socket with the Poller

    - #### events

          public boolean events()

      Processes events in the event queue of the Poller.
      Returns:
        `true` if some events were processed, `false` if queue was empty

    - #### register

          public void register(NioChannel socket)

      Registers a newly created socket with the poller.
      Parameters:
        `socket` - The newly created socket

    - #### cancelledKey

          public NioEndpoint.NioSocketWrapper cancelledKey(SelectionKey key)

    - #### 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`

    - #### processKey

          protected void processKey(SelectionKey sk,
                        NioEndpoint.NioSocketWrapper attachment)

    - #### processSendfile

          public SendfileState processSendfile(SelectionKey sk,
                                      NioEndpoint.NioSocketWrapper socketWrapper,
                                      boolean calledByProcessor)

    - #### unreg

          protected void unreg(SelectionKey sk,
                   NioEndpoint.NioSocketWrapper socketWrapper,
                   int readyOps)

    - #### reg

          protected void reg(SelectionKey sk,
                 NioEndpoint.NioSocketWrapper socketWrapper,
                 int intops)

    - #### timeout

          protected void timeout(int keyCount,
                     boolean hasEvents)

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