org.mortbay.jetty.nio
Class HttpChannelEndPoint
java.lang.Object
org.mortbay.io.nio.ChannelEndPoint
org.mortbay.jetty.nio.SelectChannelConnector.SelectChannelEndPoint
org.mortbay.jetty.nio.HttpChannelEndPoint
- All Implemented Interfaces:
- EndPoint, Runnable
- public class HttpChannelEndPoint
- extends SelectChannelConnector.SelectChannelEndPoint
- implements Runnable
_selectSet
public SelectChannelConnector.SelectSet _selectSet
_writable
protected boolean _writable
_key
protected SelectionKey _key
HttpChannelEndPoint
public HttpChannelEndPoint(SelectChannelConnector connector,
SocketChannel channel,
SelectChannelConnector.SelectSet selectSet,
SelectionKey key)
dispatch
public boolean dispatch(boolean assumeShortDispatch)
throws IOException
- Dispatch the endpoint by arranging for a thread to service it. Either a blocked thread is
woken up or the endpoint is passed to the server job queue. If the thread is dispatched and
then the selection key is modified so that it is no longer selected.
- Throws:
IOException
undispatch
public void undispatch()
- Called when a dispatched thread is no longer handling the endpoint. The selection key
operations are updated.
fill
public int fill(Buffer buffer)
throws IOException
- Description copied from interface:
EndPoint
- Fill the buffer from the current putIndex to it's capacity from whatever
byte source is backing the buffer. The putIndex is increased if bytes filled.
The buffer may chose to do a compact before filling.
- Specified by:
fill
in interface EndPoint
- Overrides:
fill
in class ChannelEndPoint
- Throws:
IOException
flush
public int flush(Buffer header,
Buffer buffer,
Buffer trailer)
throws IOException
- Description copied from interface:
EndPoint
- Flush the buffer from the current getIndex to it's putIndex using whatever byte
sink is backing the buffer. The getIndex is updated with the number of bytes flushed.
Any mark set is cleared.
If the entire contents of the buffer are flushed, then an implicit empty() is done.
The passed header/trailer buffers are written before/after the contents of this buffer. This may be done
either as gather writes, as a poke into this buffer or as several writes. The implementation is free to
select the optimal mechanism.
- Specified by:
flush
in interface EndPoint
- Overrides:
flush
in class ChannelEndPoint
- Throws:
IOException
flush
public int flush(Buffer buffer)
throws IOException
- Description copied from interface:
EndPoint
- Flush the buffer from the current getIndex to it's putIndex using whatever byte
sink is backing the buffer. The getIndex is updated with the number of bytes flushed.
Any mark set is cleared.
If the entire contents of the buffer are flushed, then an implicit empty() is done.
- Specified by:
flush
in interface EndPoint
- Overrides:
flush
in class ChannelEndPoint
- Throws:
IOException
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interface EndPoint
- Overrides:
isOpen
in class ChannelEndPoint
blockReadable
public void blockReadable(long timeoutMs)
- Specified by:
blockReadable
in interface EndPoint
- Overrides:
blockReadable
in class ChannelEndPoint
blockWritable
public void blockWritable(long timeoutMs)
- Specified by:
blockWritable
in interface EndPoint
- Overrides:
blockWritable
in class ChannelEndPoint
syncKey
public void syncKey()
- Synchronize the interestOps with the actual key. Call is scheduled by a call to updateKey
run
public void run()
- Specified by:
run
in interface Runnable
close
public void close()
throws IOException
- Description copied from interface:
EndPoint
- Close any backing stream associated with the buffer
- Specified by:
close
in interface EndPoint
- Overrides:
close
in class SelectChannelConnector.SelectChannelEndPoint
- Throws:
IOException
toString
public String toString()
getTimeoutTask
public HttpChannelEndPoint.IdleTask getTimeoutTask()
getSelectSet
public SelectChannelConnector.SelectSet getSelectSet()