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

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

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

Poller class.


Field Summary
protected  boolean close
           
protected  java.util.concurrent.ConcurrentLinkedQueue<java.lang.Runnable> events
           
protected  int keepAliveCount
           
protected  long nextExpiration
           
protected  java.nio.channels.Selector selector
           
protected  java.util.concurrent.atomic.AtomicLong wakeupCounter
           
 
Constructor Summary
NioEndpoint.Poller()
           
 
Method Summary
 void add(NioChannel socket)
          Add specified socket and associated pool to the poller.
 void add(NioChannel socket, int interestOps)
           
 void addEvent(java.lang.Runnable event)
           
 void cancelledKey(java.nio.channels.SelectionKey key, SocketStatus status)
           
protected  void destroy()
          Destroy the poller.
 boolean events()
           
 int getKeepAliveCount()
           
 java.nio.channels.Selector getSelector()
           
protected  void init()
          Create the poller.
 void register(NioChannel socket)
           
 void run()
          The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.
protected  void timeout(int keyCount, boolean hasEvents)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selector

protected java.nio.channels.Selector selector

events

protected java.util.concurrent.ConcurrentLinkedQueue<java.lang.Runnable> events

close

protected boolean close

nextExpiration

protected long nextExpiration

keepAliveCount

protected int keepAliveCount

wakeupCounter

protected java.util.concurrent.atomic.AtomicLong wakeupCounter
Constructor Detail

NioEndpoint.Poller

public NioEndpoint.Poller()
                   throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getKeepAliveCount

public int getKeepAliveCount()

getSelector

public java.nio.channels.Selector getSelector()

init

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


destroy

protected void destroy()
Destroy the poller.


addEvent

public void addEvent(java.lang.Runnable event)

add

public void add(NioChannel 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(NioChannel socket,
                int interestOps)

events

public boolean events()

register

public void register(NioChannel socket)

cancelledKey

public void cancelledKey(java.nio.channels.SelectionKey key,
                         SocketStatus status)

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

timeout

protected void timeout(int keyCount,
                       boolean hasEvents)


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