org.mortbay.jetty.grizzly
Class GrizzlyEndPoint

java.lang.Object
  extended by org.mortbay.io.nio.ChannelEndPoint
      extended by org.mortbay.jetty.grizzly.GrizzlyEndPoint
All Implemented Interfaces:
EndPoint

public class GrizzlyEndPoint
extends ChannelEndPoint


Field Summary
protected  HttpConnection _connection
           
 
Fields inherited from class org.mortbay.io.nio.ChannelEndPoint
_channel, _gather2, _gather3, _local, _remote, _socket
 
Constructor Summary
GrizzlyEndPoint(GrizzlyConnector connector, ByteChannel channel)
           
 
Method Summary
 boolean blockReadable(long millisecs)
           
 boolean blockWritable(long millisecs)
           
 void close()
          Close any backing stream associated with the buffer
 int fill(Buffer buffer)
          Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer.
 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.
 HttpConnection getHttpConnection()
           
 void handle()
           
 boolean isBlocking()
           
 boolean isComplete()
           
 boolean keepAlive()
           
 void recycle()
           
 void setChannel(ByteChannel channel)
           
 
Methods inherited from class org.mortbay.io.nio.ChannelEndPoint
flush, getChannel, getLocalAddr, getLocalHost, getLocalPort, getRemoteAddr, getRemoteHost, getRemotePort, getTransport, isBufferingInput, isBufferingOutput, isBufferred, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_connection

protected HttpConnection _connection
Constructor Detail

GrizzlyEndPoint

public GrizzlyEndPoint(GrizzlyConnector connector,
                       ByteChannel channel)
                throws IOException
Throws:
IOException
Method Detail

handle

public void handle()

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

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
Parameters:
buffer - The buffer to flush. This buffers getIndex is updated.
Returns:
the number of bytes written
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
Parameters:
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.
Returns:
the total number of bytes written.
Throws:
IOException

blockReadable

public boolean blockReadable(long millisecs)
Specified by:
blockReadable in interface EndPoint
Overrides:
blockReadable in class ChannelEndPoint

blockWritable

public boolean blockWritable(long millisecs)
Specified by:
blockWritable in interface EndPoint
Overrides:
blockWritable in class ChannelEndPoint

keepAlive

public boolean keepAlive()

isComplete

public boolean isComplete()

isBlocking

public boolean isBlocking()
Specified by:
isBlocking in interface EndPoint
Overrides:
isBlocking in class ChannelEndPoint

setChannel

public void setChannel(ByteChannel channel)

recycle

public void recycle()

getHttpConnection

public HttpConnection getHttpConnection()

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


Copyright © 2007 Mort Bay Consulting. All Rights Reserved.