org.apache.tomcat.util.net

Class NioEndpoint.Poller

public class NioEndpoint.Poller extends Object implements Runnable

Poller class.
Field Summary
protected booleanclose
protected ConcurrentLinkedQueue<Runnable>events
protected longnextExpiration
protected Selectorselector
protected CountDownLatchstopLatch
protected AtomicLongwakeupCounter
Constructor Summary
Poller()
Method Summary
voidadd(NioChannel socket)
Add specified socket and associated pool to the poller.
voidadd(NioChannel socket, int interestOps)
voidaddEvent(Runnable event)
voidcancelledKey(SelectionKey key, SocketStatus status, boolean dispatch)
voidcometInterest(NioChannel socket)
protected voiddestroy()
Destroy the poller.
booleanevents()
SelectorgetSelector()
protected booleanprocessKey(SelectionKey sk, NioEndpoint.KeyAttachment attachment)
booleanprocessSendfile(SelectionKey sk, NioEndpoint.KeyAttachment attachment, boolean reg, boolean event)
protected voidreg(SelectionKey sk, NioEndpoint.KeyAttachment attachment, int intops)
voidregister(NioChannel socket)
voidrun()
The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.
protected voidtimeout(int keyCount, boolean hasEvents)
protected voidunreg(SelectionKey sk, NioEndpoint.KeyAttachment attachment, int readyOps)
voidwakeup()

Field Detail

close

protected volatile boolean close

events

protected ConcurrentLinkedQueue<Runnable> events

nextExpiration

protected long nextExpiration

selector

protected Selector selector

stopLatch

protected CountDownLatch stopLatch

wakeupCounter

protected AtomicLong wakeupCounter

Constructor Detail

Poller

public Poller()

Method Detail

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)

addEvent

public void addEvent(Runnable event)

cancelledKey

public void cancelledKey(SelectionKey key, SocketStatus status, boolean dispatch)

cometInterest

public void cometInterest(NioChannel socket)

destroy

protected void destroy()
Destroy the poller.

events

public boolean events()

getSelector

public Selector getSelector()

processKey

protected boolean processKey(SelectionKey sk, NioEndpoint.KeyAttachment attachment)

processSendfile

public boolean processSendfile(SelectionKey sk, NioEndpoint.KeyAttachment attachment, boolean reg, boolean event)

reg

protected void reg(SelectionKey sk, NioEndpoint.KeyAttachment attachment, int intops)

register

public void register(NioChannel socket)

run

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

timeout

protected void timeout(int keyCount, boolean hasEvents)

unreg

protected void unreg(SelectionKey sk, NioEndpoint.KeyAttachment attachment, int readyOps)

wakeup

public void wakeup()
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.