org.mortbay.jetty.nio
Class SelectBlockingChannelConnector.HttpEndPoint

java.lang.Object
  extended by org.mortbay.io.nio.ChannelEndPoint
      extended by org.mortbay.jetty.nio.SelectBlockingChannelConnector.HttpEndPoint
All Implemented Interfaces:
Runnable, EndPoint
Enclosing class:
SelectBlockingChannelConnector

private class SelectBlockingChannelConnector.HttpEndPoint
extends ChannelEndPoint
implements Runnable


Field Summary
(package private)  HttpConnection _connection
           
(package private)  boolean _dispatched
           
(package private)  SelectionKey _key
           
 
Constructor Summary
SelectBlockingChannelConnector.HttpEndPoint(SocketChannel channel)
           
 
Method Summary
 void close()
          Close any backing stream associated with the buffer
(package private)  boolean dispatch()
          Dispatch the endpoint by arranging for a thread to service it.
 int fill(Buffer buffer)
          Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer.
 void run()
           
(package private)  void setKey(SelectionKey key)
           
private  void undispatch()
          Called when a dispatched thread is no longer handling the endpoint.
 
Methods inherited from class org.mortbay.io.nio.ChannelEndPoint
blockReadable, blockWritable, flush, flush, getChannel, getConnection, getLocalAddr, getLocalHost, getLocalPort, getRemoteAddr, getRemoteHost, getRemotePort, isBlocking, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_dispatched

boolean _dispatched

_key

SelectionKey _key

_connection

HttpConnection _connection
Constructor Detail

SelectBlockingChannelConnector.HttpEndPoint

SelectBlockingChannelConnector.HttpEndPoint(SocketChannel channel)
Method Detail

setKey

void setKey(SelectionKey key)

dispatch

boolean dispatch()
           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

private void undispatch()
                 throws IOException
Called when a dispatched thread is no longer handling the endpoint. The selection key operations are updated.

Throws:
IOException

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
Returns:
an int value indicating the number of bytes filled or -1 if EOF is reached.
Throws:
IOException

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 ChannelEndPoint
Throws:
IOException