public abstract class SelectorManager
extends org.mortbay.component.AbstractLifeCycle
| Modifier and Type | Class and Description |
|---|---|
class |
SelectorManager.SelectSet |
| Constructor and Description |
|---|
SelectorManager() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract SocketChannel |
acceptChannel(SelectionKey key) |
protected void |
connectionFailed(SocketChannel channel,
Throwable ex,
Object attachment) |
abstract boolean |
dispatch(Runnable task) |
void |
doSelect(int acceptorID) |
protected void |
doStart() |
protected void |
doStop() |
protected abstract void |
endPointClosed(SelectChannelEndPoint endpoint) |
protected abstract void |
endPointOpened(SelectChannelEndPoint endpoint) |
long |
getLowResourcesConnections() |
long |
getLowResourcesMaxIdleTime() |
long |
getMaxIdleTime() |
int |
getSelectSets() |
boolean |
isDelaySelectKeyUpdate() |
protected abstract Connection |
newConnection(SocketChannel channel,
SelectChannelEndPoint endpoint) |
protected abstract SelectChannelEndPoint |
newEndPoint(SocketChannel channel,
SelectorManager.SelectSet selectSet,
SelectionKey sKey) |
void |
register(ServerSocketChannel acceptChannel)
Register a serverchannel
|
void |
register(SocketChannel channel,
Object att)
Register a channel
|
void |
setDelaySelectKeyUpdate(boolean delaySelectKeyUpdate) |
void |
setLowResourcesConnections(long lowResourcesConnections)
Set the number of connections, which if exceeded places this manager in low resources state.
|
void |
setLowResourcesMaxIdleTime(long lowResourcesMaxIdleTime) |
void |
setMaxIdleTime(long maxIdleTime) |
void |
setSelectSets(int selectSets) |
public void setMaxIdleTime(long maxIdleTime)
maxIdleTime - The maximum period in milli seconds that a connection may be idle before it is closed.#setLowResourcesMaxIdleTime(long)}public void setSelectSets(int selectSets)
selectSets - public long getMaxIdleTime()
public int getSelectSets()
public boolean isDelaySelectKeyUpdate()
public void register(SocketChannel channel, Object att) throws IOException
channel - att - Attached ObjectIOExceptionpublic void register(ServerSocketChannel acceptChannel) throws IOException
acceptChannel - IOExceptionpublic long getLowResourcesConnections()
public void setLowResourcesConnections(long lowResourcesConnections)
lowResourcesConnections - the number of connections#setLowResourcesMaxIdleTime(long)}public long getLowResourcesMaxIdleTime()
public void setLowResourcesMaxIdleTime(long lowResourcesMaxIdleTime)
lowResourcesMaxIdleTime - the period in ms that a connection is allowed to be idle when this SelectSet has more connections than getLowResourcesConnections()#setMaxIdleTime(long)}public void doSelect(int acceptorID)
throws IOException
acceptorID - IOExceptionpublic void setDelaySelectKeyUpdate(boolean delaySelectKeyUpdate)
delaySelectKeyUpdate - protected abstract SocketChannel acceptChannel(SelectionKey key) throws IOException
key - IOExceptionpublic abstract boolean dispatch(Runnable task) throws IOException
IOExceptionprotected void doStart()
throws Exception
doStart in class org.mortbay.component.AbstractLifeCycleExceptionprotected void doStop()
throws Exception
doStop in class org.mortbay.component.AbstractLifeCycleExceptionprotected abstract void endPointClosed(SelectChannelEndPoint endpoint)
endpoint - protected abstract void endPointOpened(SelectChannelEndPoint endpoint)
endpoint - protected abstract Connection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint)
protected abstract SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectorManager.SelectSet selectSet, SelectionKey sKey) throws IOException
channel - selectSet - sKey - IOExceptionprotected void connectionFailed(SocketChannel channel, Throwable ex, Object attachment)
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.