public abstract class AbstractWebSocketConnection extends AbstractConnection implements LogicalConnection, IOState.ConnectionStateListener, Dumpable
LogicalConnection within the framework of the new Connection framework of jetty-io.| Modifier and Type | Class and Description |
|---|---|
class |
AbstractWebSocketConnection.OnCloseLocalCallback |
class |
AbstractWebSocketConnection.OnDisconnectCallback |
static class |
AbstractWebSocketConnection.Stats |
AbstractConnection.FillingInterestedCallback, AbstractConnection.NestedState, AbstractConnection.StateConnection.Listener, Connection.UpgradeFrom, Connection.UpgradeToEXECUTE_ONFILLABLE, FILL_INTERESTED, FILLING, FILLING_FILL_INTERESTED, IDLE, REFILLING| Constructor and Description |
|---|
AbstractWebSocketConnection(EndPoint endp,
Executor executor,
Scheduler scheduler,
WebSocketPolicy policy,
ByteBufferPool bufferPool) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close without a close code or reason
|
void |
close(int statusCode,
String reason)
Close the connection.
|
void |
disconnect()
Terminate the connection (no close frame sent)
|
String |
dump() |
void |
dump(Appendable out,
String indent) |
protected void |
execute(Runnable task) |
void |
fillInterested() |
ByteBufferPool |
getBufferPool()
Get the ByteBufferPool in use by the connection
|
Executor |
getExecutor()
Get the Executor used by this connection.
|
List<ExtensionConfig> |
getExtensions()
Get the list of extensions in use.
|
Generator |
getGenerator() |
long |
getIdleTimeout()
Get the read/write idle timeout.
|
IOState |
getIOState()
Get the IOState of the connection.
|
long |
getMaxIdleTimeout()
Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)
|
Parser |
getParser() |
WebSocketPolicy |
getPolicy()
The policy that the connection is running under.
|
InetSocketAddress |
getRemoteAddress()
Get the remote Address in use for this connection.
|
Scheduler |
getScheduler() |
WebSocketSession |
getSession()
Get the Session for this connection
|
AbstractWebSocketConnection.Stats |
getStats() |
boolean |
isOpen()
Test if logical connection is still open
|
boolean |
isReading()
Tests if the connection is actively reading.
|
void |
onClose()
Physical connection disconnect.
|
void |
onConnectionStateChange(ConnectionState state) |
void |
onFillable() |
protected void |
onFillInterestedFailed(Throwable cause) |
void |
onOpen() |
protected boolean |
onReadTimeout()
Event for no activity on connection (read or write)
|
void |
outgoingFrame(Frame frame,
WriteCallback callback,
BatchMode batchMode)
Frame from API, User, or Internal implementation destined for network.
|
protected void |
prefill(ByteBuffer prefilled) |
void |
resume() |
void |
setExtensions(List<ExtensionConfig> extensions)
Get the list of extensions in use.
|
void |
setInputBufferSize(int inputBufferSize) |
void |
setMaxIdleTimeout(long ms)
Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)
|
void |
setSession(WebSocketSession session)
Set the session associated with this connection
|
SuspendToken |
suspend()
Suspend a the incoming read events on the connection.
|
String |
toString() |
addListener, failedCallback, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getInputBufferSize, getMessagesIn, getMessagesOut, nextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLocalAddress, setNextIncomingFramespublic AbstractWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool)
public Executor getExecutor()
LogicalConnectiongetExecutor in interface LogicalConnectiongetExecutor in class AbstractConnectionpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in interface Connectionclose in interface LogicalConnectionclose in class AbstractConnectionStatusCode,
LogicalConnection.close(int, String)public void close(int statusCode,
String reason)
fillInterested(); This can result in a close handshake over the network, or a simple local abnormal close
close in interface LogicalConnectionstatusCode - the WebSocket status code.reason - the (optional) reason string. (null is allowed)StatusCodepublic void disconnect()
LogicalConnectiondisconnect in interface LogicalConnectionprotected void execute(Runnable task)
public void fillInterested()
fillInterested in class AbstractConnectionpublic ByteBufferPool getBufferPool()
LogicalConnectiongetBufferPool in interface LogicalConnectionpublic List<ExtensionConfig> getExtensions()
This list is negotiated during the WebSocket Upgrade Request/Response handshake.
public Generator getGenerator()
public long getIdleTimeout()
LogicalConnectiongetIdleTimeout in interface LogicalConnectionpublic IOState getIOState()
LogicalConnectiongetIOState in interface LogicalConnectionpublic long getMaxIdleTimeout()
LogicalConnectiongetMaxIdleTimeout in interface LogicalConnectionpublic Parser getParser()
public WebSocketPolicy getPolicy()
LogicalConnectiongetPolicy in interface LogicalConnectionpublic InetSocketAddress getRemoteAddress()
LogicalConnectionNote: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
getRemoteAddress in interface LogicalConnectionpublic Scheduler getScheduler()
public WebSocketSession getSession()
LogicalConnectiongetSession in interface LogicalConnectionpublic AbstractWebSocketConnection.Stats getStats()
public boolean isOpen()
LogicalConnectionisOpen in interface LogicalConnectionpublic boolean isReading()
LogicalConnectionisReading in interface LogicalConnectionpublic void onClose()
Not related to WebSocket close handshake.
onClose in interface ConnectiononClose in class AbstractConnectionpublic void onConnectionStateChange(ConnectionState state)
onConnectionStateChange in interface IOState.ConnectionStateListenerpublic void onFillable()
onFillable in class AbstractConnectionprotected void onFillInterestedFailed(Throwable cause)
onFillInterestedFailed in class AbstractConnectionprotected void prefill(ByteBuffer prefilled)
public void onOpen()
onOpen in interface ConnectiononOpen in class AbstractConnectionprotected boolean onReadTimeout()
onReadTimeout in class AbstractConnectionpublic void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
outgoingFrame in interface OutgoingFramespublic void resume()
resume in interface SuspendTokenpublic void setExtensions(List<ExtensionConfig> extensions)
This list is negotiated during the WebSocket Upgrade Request/Response handshake.
extensions - the list of negotiated extensions in use.public void setInputBufferSize(int inputBufferSize)
setInputBufferSize in class AbstractConnectionpublic void setMaxIdleTimeout(long ms)
LogicalConnectionThis idle timeout cannot be garunteed to take immediate effect for any active read/write actions. New read/write actions will have this new idle timeout.
setMaxIdleTimeout in interface LogicalConnectionms - the number of milliseconds of idle timeoutpublic void setSession(WebSocketSession session)
LogicalConnectionsetSession in interface LogicalConnectionsession - the sessionpublic SuspendToken suspend()
LogicalConnectionsuspend in interface LogicalConnectionpublic void dump(Appendable out, String indent) throws IOException
dump in interface DumpableIOExceptionpublic String toString()
toString in class AbstractConnectionCopyright © 1995-2016 Webtide. All Rights Reserved.