public abstract class AbstractConnection extends Object implements Connection
A convenience base implementation of Connection.
This class uses the capabilities of the EndPoint API to provide a
more traditional style of async reading. A call to fillInterested()
will schedule a callback to onFillable() or onFillInterestedFailed(Throwable)
as appropriate.
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractConnection(EndPoint endp,
Executor executor) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addListener(Connection.Listener listener)
Adds a listener of connection events.
|
void |
close()
Performs a logical close of this connection.
|
protected void |
failedCallback(org.eclipse.jetty.util.Callback callback,
Throwable x) |
void |
fillInterested()
Utility method to be called to register read interest.
|
long |
getBytesIn() |
long |
getBytesOut() |
long |
getCreatedTimeStamp() |
EndPoint |
getEndPoint() |
protected Executor |
getExecutor() |
int |
getInputBufferSize() |
long |
getMessagesIn() |
long |
getMessagesOut() |
boolean |
isFillInterested() |
void |
onClose()
Callback method invoked when this connection is closed.
|
abstract void |
onFillable()
Callback method invoked when the endpoint is ready to be read.
|
protected void |
onFillInterestedFailed(Throwable cause)
Callback method invoked when the endpoint failed to be ready to be read.
|
boolean |
onIdleExpired()
Callback method invoked upon an idle timeout event.
|
void |
onOpen()
Callback method invoked when this connection is opened.
|
protected boolean |
onReadTimeout()
Callback method invoked when the endpoint failed to be ready to be read after a timeout
|
void |
removeListener(Connection.Listener listener)
Removes a listener of connection events.
|
void |
setInputBufferSize(int inputBufferSize) |
String |
toConnectionString() |
String |
toString() |
void |
tryFillInterested() |
void |
tryFillInterested(org.eclipse.jetty.util.Callback callback) |
public void addListener(Connection.Listener listener)
ConnectionAdds a listener of connection events.
addListener 在接口中 Connectionlistener - the listener to addpublic void removeListener(Connection.Listener listener)
ConnectionRemoves a listener of connection events.
removeListener 在接口中 Connectionlistener - the listener to removepublic int getInputBufferSize()
public void setInputBufferSize(int inputBufferSize)
protected Executor getExecutor()
protected void failedCallback(org.eclipse.jetty.util.Callback callback,
Throwable x)
public void fillInterested()
Utility method to be called to register read interest.
After a call to this method, onFillable() or onFillInterestedFailed(Throwable)
will be called back as appropriate.
onFillable()public void tryFillInterested()
public void tryFillInterested(org.eclipse.jetty.util.Callback callback)
public boolean isFillInterested()
public abstract void onFillable()
Callback method invoked when the endpoint is ready to be read.
fillInterested()protected void onFillInterestedFailed(Throwable cause)
Callback method invoked when the endpoint failed to be ready to be read.
cause - the exception that caused the failureprotected boolean onReadTimeout()
Callback method invoked when the endpoint failed to be ready to be read after a timeout
public void onOpen()
ConnectionCallback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
onOpen 在接口中 Connectionpublic void onClose()
ConnectionCallback method invoked when this connection is closed.
Creators of the connection implementation are responsible for calling this method.
onClose 在接口中 Connectionpublic EndPoint getEndPoint()
getEndPoint 在接口中 ConnectionEndPoint associated with this Connection.public void close()
ConnectionPerforms a logical close of this connection.
For simple connections, this may just mean to delegate the close to the associated
EndPoint but, for example, SSL connections should write the SSL close message
before closing the associated EndPoint.
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在接口中 Connectionpublic boolean onIdleExpired()
ConnectionCallback method invoked upon an idle timeout event.
Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.
When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.
onIdleExpired 在接口中 Connectionpublic long getMessagesIn()
getMessagesIn 在接口中 Connectionpublic long getMessagesOut()
getMessagesOut 在接口中 Connectionpublic long getBytesIn()
getBytesIn 在接口中 Connectionpublic long getBytesOut()
getBytesOut 在接口中 Connectionpublic long getCreatedTimeStamp()
getCreatedTimeStamp 在接口中 Connectionpublic String toConnectionString()
Copyright © 2017. All rights reserved.