org.mortbay.io.nio
public class SelectChannelEndPoint extends ChannelEndPoint implements java.lang.Runnable
SelectorManager
.Modifier and Type | Class and Description |
---|---|
class |
SelectChannelEndPoint.IdleTask |
Modifier and Type | Field and Description |
---|---|
protected Connection |
_connection |
protected boolean |
_dispatched |
protected int |
_interestOps |
protected java.nio.channels.SelectionKey |
_key |
protected SelectorManager |
_manager |
protected boolean |
_readBlocked |
protected SelectorManager.SelectSet |
_selectSet |
protected boolean |
_writable |
protected boolean |
_writeBlocked |
Constructor and Description |
---|
SelectChannelEndPoint(java.nio.channels.SocketChannel channel,
SelectorManager.SelectSet selectSet,
java.nio.channels.SelectionKey key) |
Modifier and Type | Method and Description |
---|---|
boolean |
blockReadable(long timeoutMs) |
boolean |
blockWritable(long timeoutMs) |
void |
cancelIdle() |
void |
close()
Close any backing stream associated with the buffer
|
boolean |
dispatch(boolean assumeShortDispatch)
Put the endpoint into the dispatched state.
|
int |
flush(Buffer buffer)
Flush the buffer from the current getIndex to it's putIndex using whatever byte
sink is backing the buffer.
|
int |
flush(Buffer header,
Buffer buffer,
Buffer trailer)
Flush the buffer from the current getIndex to it's putIndex using whatever byte
sink is backing the buffer.
|
Connection |
getConnection() |
SelectorManager.SelectSet |
getSelectSet() |
org.mortbay.thread.Timeout.Task |
getTimeoutTask() |
protected void |
idleExpired() |
void |
run() |
void |
scheduleIdle() |
void |
scheduleWrite() |
void |
setWritable(boolean writable) |
java.lang.String |
toString() |
void |
undispatch()
Called when a dispatched thread is no longer handling the endpoint.
|
fill, flush, getChannel, getLocalAddr, getLocalHost, getLocalPort, getRemoteAddr, getRemoteHost, getRemotePort, getTransport, isBlocking, isBufferingInput, isBufferingOutput, isBufferred, isOpen, shutdownOutput
protected SelectorManager _manager
protected SelectorManager.SelectSet _selectSet
protected boolean _dispatched
protected boolean _writable
protected java.nio.channels.SelectionKey _key
protected int _interestOps
protected boolean _readBlocked
protected boolean _writeBlocked
protected Connection _connection
public SelectChannelEndPoint(java.nio.channels.SocketChannel channel, SelectorManager.SelectSet selectSet, java.nio.channels.SelectionKey key)
public Connection getConnection()
public boolean dispatch(boolean assumeShortDispatch) throws java.io.IOException
assumeShortDispatch
- If true, the interested ops are not modified.java.io.IOException
public void scheduleIdle()
public void cancelIdle()
protected void idleExpired()
public void undispatch()
public int flush(Buffer header, Buffer buffer, Buffer trailer) throws java.io.IOException
EndPoint
flush
in interface EndPoint
flush
in class ChannelEndPoint
header
- A buffer to write before flushing this buffer. This buffers getIndex is updated.buffer
- The buffer to flush. This buffers getIndex is updated.trailer
- A buffer to write after flushing this buffer. This buffers getIndex is updated.java.io.IOException
public int flush(Buffer buffer) throws java.io.IOException
EndPoint
flush
in interface EndPoint
flush
in class ChannelEndPoint
buffer
- The buffer to flush. This buffers getIndex is updated.java.io.IOException
public boolean blockReadable(long timeoutMs) throws java.io.IOException
blockReadable
in interface EndPoint
blockReadable
in class ChannelEndPoint
java.io.IOException
public boolean blockWritable(long timeoutMs) throws java.io.IOException
blockWritable
in interface EndPoint
blockWritable
in class ChannelEndPoint
java.io.IOException
public void setWritable(boolean writable)
public void scheduleWrite()
public void run()
run
in interface java.lang.Runnable
public void close() throws java.io.IOException
EndPoint
close
in interface EndPoint
close
in class ChannelEndPoint
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public org.mortbay.thread.Timeout.Task getTimeoutTask()
public SelectorManager.SelectSet getSelectSet()
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.