org.apache.tomcat.util.net
Class AprEndpoint.Poller

java.lang.Object
  extended by org.apache.tomcat.util.net.AprEndpoint.Poller
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
AprEndpoint

public class AprEndpoint.Poller
extends java.lang.Object
implements java.lang.Runnable

Poller class.


Field Summary
protected  int actualPollerSize
          Actual poller size.
protected  AprEndpoint.SocketList addList
          List of sockets to be added to the poller.
protected  int connectionCount
          Amount of connections inside this poller.
protected  long[] desc
          Socket descriptors.
protected  boolean event
          Event mode flag.
protected  long lastMaintain
          Last run of maintain.
protected  AprEndpoint.SocketList localAddList
          List of sockets to be added to the poller.
protected  int pollerCount
          Amount of low level pollers in use by this poller.
protected  long[] pollers
          Pointers to the pollers.
protected  int[] pollerSpace
          Amount of spots left in the poller.
protected  int pollerTime
          Timeout value for the poll call.
protected  long pool
          Root pool.
protected  AprEndpoint.SocketTimeouts timeouts
          Structure used for storing timeouts.
 
Constructor Summary
AprEndpoint.Poller(boolean event)
           
 
Method Summary
 void add(long socket)
          Add specified socket and associated pool to the poller.
 void add(long socket, int timeout, boolean read, boolean write, boolean resume, boolean wakeup)
          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  void destroy()
          Destroy the poller.
 int getConnectionCount()
           
protected  void init()
          Create the poller.
protected  void maintain()
          Timeout checks.
protected  boolean removeFromPoller(long socket)
          Remove specified socket from the pollers.
 void run()
          The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.
 java.lang.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

pollers

protected long[] pollers
Pointers to the pollers.


actualPollerSize

protected int actualPollerSize
Actual poller size.


pollerSpace

protected int[] pollerSpace
Amount of spots left in the poller.


pollerCount

protected int pollerCount
Amount of low level pollers in use by this poller.


pollerTime

protected int pollerTime
Timeout value for the poll call.


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.


localAddList

protected AprEndpoint.SocketList localAddList
List of sockets to be added to the poller.


event

protected boolean event
Event mode flag.


timeouts

protected AprEndpoint.SocketTimeouts timeouts
Structure used for storing timeouts.


lastMaintain

protected long lastMaintain
Last run of maintain. Maintain will run usually every 5s.


connectionCount

protected int connectionCount
Amount of connections inside this poller.

Constructor Detail

AprEndpoint.Poller

public AprEndpoint.Poller(boolean event)
Method Detail

getConnectionCount

public int getConnectionCount()

init

protected void init()
Create the poller. With some versions of APR, the maximum poller size will be 62 (recompiling APR is necessary to remove this limitation).


destroy

protected void destroy()
Destroy the poller.


add

public void add(long socket)
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

add

public void add(long socket,
                int timeout,
                boolean read,
                boolean write,
                boolean resume,
                boolean wakeup)
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
resume - to send a callback event

addToPoller

protected boolean addToPoller(long socket,
                              int events)
Add specified socket to one of the pollers.


removeFromPoller

protected boolean removeFromPoller(long socket)
Remove specified socket from the pollers.


maintain

protected void maintain()
Timeout checks.


toString

public java.lang.String toString()
Displays the list of sockets in the pollers.

Overrides:
toString in class java.lang.Object

run

public void run()
The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.

Specified by:
run in interface java.lang.Runnable


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