public abstract class SelectorManager extends AbstractLifeCycle implements Dumpable
Modifier and Type | Class and Description |
---|---|
class |
SelectorManager.SelectSet |
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
static Logger |
LOG |
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
Constructor and Description |
---|
SelectorManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
connectionFailed(SocketChannel channel,
Throwable ex,
Object attachment) |
abstract boolean |
dispatch(Runnable task) |
protected void |
doStart() |
protected void |
doStop() |
String |
dump() |
void |
dump(Appendable out,
String indent) |
protected abstract void |
endPointClosed(SelectChannelEndPoint endpoint) |
protected abstract void |
endPointOpened(SelectChannelEndPoint endpoint) |
protected abstract void |
endPointUpgraded(ConnectedEndPoint endpoint,
Connection oldConnection) |
long |
getLowResourcesConnections() |
long |
getLowResourcesMaxIdleTime() |
long |
getMaxIdleTime() |
int |
getSelectorPriorityDelta() |
SelectorManager.SelectSet |
getSelectSet(int i) |
int |
getSelectSets() |
boolean |
isDeferringInterestedOps0() |
abstract AsyncConnection |
newConnection(SocketChannel channel,
AsyncEndPoint endpoint,
Object attachment) |
protected abstract SelectChannelEndPoint |
newEndPoint(SocketChannel channel,
SelectorManager.SelectSet selectSet,
SelectionKey sKey)
Create a new end point
|
void |
register(ServerSocketChannel acceptChannel)
Register a
ServerSocketChannel |
void |
register(SocketChannel channel)
Register a channel
|
void |
register(SocketChannel channel,
Object att)
Register a channel
|
void |
setDeferringInterestedOps0(boolean deferringInterestedOps0) |
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 |
setSelectorPriorityDelta(int delta)
Set the selector thread priorty delta.
|
void |
setSelectSets(int selectSets) |
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public static final Logger LOG
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
- number of select sets to createpublic long getMaxIdleTime()
public int getSelectSets()
public SelectorManager.SelectSet getSelectSet(int i)
i
- public void register(SocketChannel channel, Object att)
channel
- att
- Attached Objectpublic void register(SocketChannel channel)
channel
- public void register(ServerSocketChannel acceptChannel)
ServerSocketChannel
acceptChannel
- public int getSelectorPriorityDelta()
public void setSelectorPriorityDelta(int delta)
delta
- The value to add to the selector thread priority.public long getLowResourcesConnections()
public void setLowResourcesConnections(long lowResourcesConnections)
lowResourcesConnections
- the number of connectionssetLowResourcesMaxIdleTime(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 abstract boolean dispatch(Runnable task)
protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
protected abstract void endPointClosed(SelectChannelEndPoint endpoint)
endpoint
- protected abstract void endPointOpened(SelectChannelEndPoint endpoint)
endpoint
- protected abstract void endPointUpgraded(ConnectedEndPoint endpoint, Connection oldConnection)
public abstract AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint, Object attachment)
protected abstract SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectorManager.SelectSet selectSet, SelectionKey sKey) throws IOException
channel
- selectSet
- sKey
- the selection keySelectChannelEndPoint
IOException
protected void connectionFailed(SocketChannel channel, Throwable ex, Object attachment)
public void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
IOException
public boolean isDeferringInterestedOps0()
public void setDeferringInterestedOps0(boolean deferringInterestedOps0)
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.