org.eclipse.jetty.io.nio
Class SslConnection.SslEndPoint

java.lang.Object
  extended by org.eclipse.jetty.io.nio.SslConnection.SslEndPoint
All Implemented Interfaces:
AsyncEndPoint, ConnectedEndPoint, EndPoint
Enclosing class:
SslConnection

public class SslConnection.SslEndPoint
extends Object
implements AsyncEndPoint


Constructor Summary
SslConnection.SslEndPoint()
           
 
Method Summary
 void asyncDispatch()
          Dispatch the endpoint to a thread to attend to it.
 boolean blockReadable(long millisecs)
           
 boolean blockWritable(long millisecs)
           
 void cancelTimeout(Timeout.Task task)
           
 void close()
          Close any backing stream associated with the endpoint
 int fill(Buffer buffer)
          Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer.
 void flush()
          Flush any buffered output.
 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()
           
 String getLocalAddr()
           
 String getLocalHost()
           
 int getLocalPort()
           
 int getMaxIdleTime()
          Get the max idle time in ms.
 String getRemoteAddr()
           
 String getRemoteHost()
           
 int getRemotePort()
           
 SSLEngine getSslEngine()
           
 Object getTransport()
           
 boolean hasProgressed()
           
 boolean isBlocking()
           
 boolean isCheckForIdle()
          Get if the endpoint should be checked for idleness
 boolean isInputShutdown()
           
 boolean isOpen()
           
 boolean isOutputShutdown()
           
 boolean isWritable()
           
 void onIdleExpired()
          Callback when idle.
 void scheduleTimeout(Timeout.Task task, long timeoutMs)
           
 void scheduleWrite()
          Schedule a write dispatch.
 void setCheckForIdle(boolean check)
          Set if the endpoint should be checked for idleness
 void setConnection(Connection connection)
           
 void setMaxIdleTime(int timeMs)
          Set the max idle time.
 void shutdownInput()
          Shutdown any backing input stream associated with the endpoint
 void shutdownOutput()
          Shutdown any backing output stream associated with the endpoint
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SslConnection.SslEndPoint

public SslConnection.SslEndPoint()
Method Detail

getSslEngine

public SSLEngine getSslEngine()

shutdownOutput

public void shutdownOutput()
                    throws IOException
Description copied from interface: EndPoint
Shutdown any backing output stream associated with the endpoint

Specified by:
shutdownOutput in interface EndPoint
Throws:
IOException

isOutputShutdown

public boolean isOutputShutdown()
Specified by:
isOutputShutdown in interface EndPoint

shutdownInput

public void shutdownInput()
                   throws IOException
Description copied from interface: EndPoint
Shutdown any backing input stream associated with the endpoint

Specified by:
shutdownInput in interface EndPoint
Throws:
IOException

isInputShutdown

public boolean isInputShutdown()
Specified by:
isInputShutdown in interface EndPoint

close

public void close()
           throws IOException
Description copied from interface: EndPoint
Close any backing stream associated with the endpoint

Specified by:
close in interface EndPoint
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
Returns:
an int value indicating the number of bytes filled or -1 if EOF is reached.
Throws:
EofException - If input is shutdown or the endpoint is closed.
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
Parameters:
buffer - The buffer to flush. This buffers getIndex is updated.
Returns:
the number of bytes written
Throws:
EofException - If the endpoint is closed or output is shutdown.
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
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)
                      throws IOException
Specified by:
blockReadable in interface EndPoint
Throws:
IOException

blockWritable

public boolean blockWritable(long millisecs)
                      throws IOException
Specified by:
blockWritable in interface EndPoint
Throws:
IOException

isOpen

public boolean isOpen()
Specified by:
isOpen in interface EndPoint

getTransport

public Object getTransport()
Specified by:
getTransport in interface EndPoint
Returns:
The underlying transport object (socket, channel, etc.)

flush

public void flush()
           throws IOException
Description copied from interface: EndPoint
Flush any buffered output. May fail to write all data if endpoint is non-blocking

Specified by:
flush in interface EndPoint
Throws:
EofException - If the endpoint is closed or output is shutdown.
IOException

asyncDispatch

public void asyncDispatch()
Description copied from interface: AsyncEndPoint
Dispatch the endpoint to a thread to attend to it.

Specified by:
asyncDispatch in interface AsyncEndPoint

scheduleWrite

public void scheduleWrite()
Description copied from interface: AsyncEndPoint
Schedule a write dispatch. Set the endpoint to not be writable and schedule a dispatch when it becomes writable.

Specified by:
scheduleWrite in interface AsyncEndPoint

onIdleExpired

public void onIdleExpired()
Description copied from interface: AsyncEndPoint
Callback when idle.

An endpoint is idle if there has been no IO activity for EndPoint.getMaxIdleTime() and AsyncEndPoint.isCheckForIdle() is true.

Specified by:
onIdleExpired in interface AsyncEndPoint

setCheckForIdle

public void setCheckForIdle(boolean check)
Description copied from interface: AsyncEndPoint
Set if the endpoint should be checked for idleness

Specified by:
setCheckForIdle in interface AsyncEndPoint

isCheckForIdle

public boolean isCheckForIdle()
Description copied from interface: AsyncEndPoint
Get if the endpoint should be checked for idleness

Specified by:
isCheckForIdle in interface AsyncEndPoint

scheduleTimeout

public void scheduleTimeout(Timeout.Task task,
                            long timeoutMs)
Specified by:
scheduleTimeout in interface AsyncEndPoint

cancelTimeout

public void cancelTimeout(Timeout.Task task)
Specified by:
cancelTimeout in interface AsyncEndPoint

isWritable

public boolean isWritable()
Specified by:
isWritable in interface AsyncEndPoint

hasProgressed

public boolean hasProgressed()
Specified by:
hasProgressed in interface AsyncEndPoint
Returns:
True if IO has been successfully performed since the last call to AsyncEndPoint.hasProgressed()

getLocalAddr

public String getLocalAddr()
Specified by:
getLocalAddr in interface EndPoint
Returns:
The local IP address to which this EndPoint is bound, or null if this EndPoint does not represent a network connection.

getLocalHost

public String getLocalHost()
Specified by:
getLocalHost in interface EndPoint
Returns:
The local host name to which this EndPoint is bound, or null if this EndPoint does not represent a network connection.

getLocalPort

public int getLocalPort()
Specified by:
getLocalPort in interface EndPoint
Returns:
The local port number on which this EndPoint is listening, or 0 if this EndPoint does not represent a network connection.

getRemoteAddr

public String getRemoteAddr()
Specified by:
getRemoteAddr in interface EndPoint
Returns:
The remote IP address to which this EndPoint is connected, or null if this EndPoint does not represent a network connection.

getRemoteHost

public String getRemoteHost()
Specified by:
getRemoteHost in interface EndPoint
Returns:
The host name of the remote machine to which this EndPoint is connected, or null if this EndPoint does not represent a network connection.

getRemotePort

public int getRemotePort()
Specified by:
getRemotePort in interface EndPoint
Returns:
The remote port number to which this EndPoint is connected, or 0 if this EndPoint does not represent a network connection.

isBlocking

public boolean isBlocking()
Specified by:
isBlocking in interface EndPoint

getMaxIdleTime

public int getMaxIdleTime()
Description copied from interface: EndPoint
Get the max idle time in ms.

The max idle time is the time the endpoint can be idle before extraordinary handling takes place. This loosely corresponds to the Socket.getSoTimeout() for blocking connections, but AsyncEndPoint implementations must use other mechanisms to implement the max idle time.

Specified by:
getMaxIdleTime in interface EndPoint
Returns:
the max idle time in ms or if ms <= 0 implies an infinite timeout

setMaxIdleTime

public void setMaxIdleTime(int timeMs)
                    throws IOException
Description copied from interface: EndPoint
Set the max idle time.

Specified by:
setMaxIdleTime in interface EndPoint
Parameters:
timeMs - the max idle time in MS. Timeout <= 0 implies an infinite timeout
Throws:
IOException - if the timeout cannot be set.

getConnection

public Connection getConnection()
Specified by:
getConnection in interface ConnectedEndPoint

setConnection

public void setConnection(Connection connection)
Specified by:
setConnection in interface ConnectedEndPoint

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.