public class WsRemoteEndpointImplServer extends WsRemoteEndpointImplBase
RemoteEndpoint implementation - i.e. what the server uses to send
data to the client.RemoteEndpoint.Async, RemoteEndpoint.BasicmessagePartInProgress, SENDRESULT_OK| Constructor and Description |
|---|
WsRemoteEndpointImplServer(SocketWrapperBase<?> socketWrapper,
UpgradeInfo upgradeInfo,
WsServerContainer serverContainer,
WebConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acquireMessagePartInProgressSemaphore(byte opCode,
long timeoutExpiry)
Acquire the semaphore that allows a message part to be written.
|
protected void |
doClose() |
protected void |
doWrite(SendHandler handler,
long blockingWriteTimeoutExpiry,
java.nio.ByteBuffer... buffers) |
protected java.util.concurrent.locks.Lock |
getLock() |
protected long |
getTimeoutExpiry() |
protected boolean |
isMasked() |
protected void |
onTimeout(boolean useDispatch) |
void |
onWritePossible(boolean useDispatch) |
protected void |
setTransformation(Transformation transformation) |
protected void |
updateStats(long payloadLength)
Hook for updating server side statistics.
|
close, flushBatch, getBatchingAllowed, getSendStream, getSendTimeout, getSendWriter, sendBytes, sendBytesByCompletion, sendBytesByFuture, sendObject, sendObjectByCompletion, sendObjectByFuture, sendPartialBytes, sendPartialString, sendPing, sendPong, sendString, sendStringByCompletion, sendStringByFuture, setBatchingAllowed, setEncoders, setSendTimeout, setSessionpublic WsRemoteEndpointImplServer(SocketWrapperBase<?> socketWrapper, UpgradeInfo upgradeInfo, WsServerContainer serverContainer, WebConnection connection)
protected final boolean isMasked()
isMasked in class WsRemoteEndpointImplBaseprotected boolean acquireMessagePartInProgressSemaphore(byte opCode,
long timeoutExpiry)
throws java.lang.InterruptedException
The close message is a special case. It needs to be blocking else implementing the clean-up that follows the sending of the close message gets a lot more complicated. On the server, this creates additional complications as a dead-lock may occur in the following scenario:
true) and upgrade processors are never pooled.
TODO: Despite the complications it creates, it would be worth exploring the possibility of processing a received close frame in a non-blocking manner.
acquireMessagePartInProgressSemaphore in class WsRemoteEndpointImplBaseopCode - The OPCODE for the message to be writtentimeoutExpiry - The time when the attempt to acquire the semaphore should expiretrue if the semaphore is obtained, otherwise false.java.lang.InterruptedException - If the wait for the semaphore is interruptedprotected void doWrite(SendHandler handler, long blockingWriteTimeoutExpiry, java.nio.ByteBuffer... buffers)
doWrite in class WsRemoteEndpointImplBaseprotected void updateStats(long payloadLength)
WsRemoteEndpointImplBaseupdateStats in class WsRemoteEndpointImplBasepayloadLength - Size of message payloadpublic void onWritePossible(boolean useDispatch)
protected void doClose()
doClose in class WsRemoteEndpointImplBaseprotected long getTimeoutExpiry()
protected void onTimeout(boolean useDispatch)
protected void setTransformation(Transformation transformation)
setTransformation in class WsRemoteEndpointImplBaseprotected java.util.concurrent.locks.Lock getLock()
getLock in class WsRemoteEndpointImplBaseCopyright © 2000-2024 Apache Software Foundation.
Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo are either registered trademarks or trademarks of the Apache Software Foundation.