org.mortbay.io.nio
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 java.nio.channels.SocketChannel |
acceptChannel(java.nio.channels.SelectionKey key) |
protected void |
connectionFailed(java.nio.channels.SocketChannel channel,
java.lang.Throwable ex,
java.lang.Object attachment) |
abstract boolean |
dispatch(java.lang.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(java.nio.channels.SocketChannel channel,
SelectChannelEndPoint endpoint) |
protected abstract SelectChannelEndPoint |
newEndPoint(java.nio.channels.SocketChannel channel,
SelectorManager.SelectSet selectSet,
java.nio.channels.SelectionKey sKey) |
void |
register(java.nio.channels.ServerSocketChannel acceptChannel)
Register a serverchannel
|
void |
register(java.nio.channels.SocketChannel channel,
java.lang.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(java.nio.channels.SocketChannel channel,
java.lang.Object att)
throws java.io.IOException
channel - att - Attached Objectjava.io.IOExceptionpublic void register(java.nio.channels.ServerSocketChannel acceptChannel)
throws java.io.IOException
acceptChannel - java.io.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 java.io.IOException
acceptorID - java.io.IOExceptionpublic void setDelaySelectKeyUpdate(boolean delaySelectKeyUpdate)
delaySelectKeyUpdate - protected abstract java.nio.channels.SocketChannel acceptChannel(java.nio.channels.SelectionKey key)
throws java.io.IOException
key - java.io.IOExceptionpublic abstract boolean dispatch(java.lang.Runnable task)
throws java.io.IOException
java.io.IOExceptionprotected void doStart()
throws java.lang.Exception
doStart in class org.mortbay.component.AbstractLifeCyclejava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
doStop in class org.mortbay.component.AbstractLifeCyclejava.lang.Exceptionprotected abstract void endPointClosed(SelectChannelEndPoint endpoint)
endpoint - protected abstract void endPointOpened(SelectChannelEndPoint endpoint)
endpoint - protected abstract Connection newConnection(java.nio.channels.SocketChannel channel, SelectChannelEndPoint endpoint)
protected abstract SelectChannelEndPoint newEndPoint(java.nio.channels.SocketChannel channel, SelectorManager.SelectSet selectSet, java.nio.channels.SelectionKey sKey) throws java.io.IOException
channel - selectSet - sKey - java.io.IOExceptionprotected void connectionFailed(java.nio.channels.SocketChannel channel,
java.lang.Throwable ex,
java.lang.Object attachment)
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.