org.eclipse.jetty.io
接口 Connection

所有已知子接口:
AsyncConnection, WebSocketConnection, WebSocketServletConnection
所有已知实现类:
AbstractConnection, AbstractHttpConnection, AbstractHttpConnection, Ajp13Connection, AsyncHttpConnection, AsyncHttpConnection, BlockingHttpConnection, BlockingHttpConnection, ConnectHandler.ClientToProxyConnection, ConnectHandler.ProxyToServerConnection, NestedConnection, SslConnection, WebSocketConnectionD00, WebSocketConnectionD06, WebSocketConnectionD08, WebSocketConnectionRFC6455, WebSocketServletConnectionD00, WebSocketServletConnectionD06, WebSocketServletConnectionD08, WebSocketServletConnectionRFC6455

public interface Connection

Abstract Connection used by Jetty Connectors.

Jetty will call the handle method of a connection when there is work to be done on the connection. For blocking connections, this is soon as the connection is open and handle will keep being called until the connection is closed. For non-blocking connections, handle will only be called if there are bytes to be read or the connection becomes writable after being write blocked.

另请参见:
SelectorManager

方法摘要
 long getTimeStamp()
           
 Connection handle()
          Handle the connection.
 boolean isIdle()
           
 boolean isSuspended()
          The semantic of this method is to return true to indicate interest in further reads, or false otherwise, but it is misnamed and should be really called isReadInterested().
 void onClose()
          Called after the connection is closed
 void onIdleExpired(long idleForMs)
          Called when the connection idle timeout expires
 

方法详细信息

handle

Connection handle()
                  throws IOException
Handle the connection.

返回:
The Connection to use for the next handling of the connection. This allows protocol upgrades and support for CONNECT.
抛出:
IOException - if the handling of I/O operations fail

getTimeStamp

long getTimeStamp()
返回:
the timestamp at which the connection was created

isIdle

boolean isIdle()
返回:
whether this connection is idle, that is not parsing and not generating
另请参见:
onIdleExpired(long)

isSuspended

boolean isSuspended()

The semantic of this method is to return true to indicate interest in further reads, or false otherwise, but it is misnamed and should be really called isReadInterested().

返回:
true to indicate interest in further reads, false otherwise

onClose

void onClose()
Called after the connection is closed


onIdleExpired

void onIdleExpired(long idleForMs)
Called when the connection idle timeout expires

参数:
idleForMs - how long the connection has been idle
另请参见:
isIdle()


Copyright © 2013. All Rights Reserved.