public abstract class WsRemoteEndpointImplBase extends java.lang.Object implements RemoteEndpoint
RemoteEndpoint.Async, RemoteEndpoint.Basic| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.Semaphore |
messagePartInProgress |
protected static SendResult |
SENDRESULT_OK |
protected static StringManager |
sm |
| Constructor and Description |
|---|
WsRemoteEndpointImplBase() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acquireMessagePartInProgressSemaphore(byte opCode,
long timeoutExpiry)
Acquire the semaphore that allows a message part to be written.
|
void |
close() |
protected abstract void |
doClose() |
protected abstract void |
doWrite(SendHandler handler,
long blockingWriteTimeoutExpiry,
java.nio.ByteBuffer... data) |
void |
flushBatch()
Flush any currently batched messages to the remote endpoint.
|
boolean |
getBatchingAllowed()
Obtains the current batching status of the endpoint.
|
protected abstract java.util.concurrent.locks.Lock |
getLock() |
java.io.OutputStream |
getSendStream() |
long |
getSendTimeout() |
java.io.Writer |
getSendWriter() |
protected abstract boolean |
isMasked() |
void |
sendBytes(java.nio.ByteBuffer data) |
void |
sendBytesByCompletion(java.nio.ByteBuffer data,
SendHandler handler) |
java.util.concurrent.Future<java.lang.Void> |
sendBytesByFuture(java.nio.ByteBuffer data) |
void |
sendObject(java.lang.Object obj) |
void |
sendObjectByCompletion(java.lang.Object obj,
SendHandler completion) |
java.util.concurrent.Future<java.lang.Void> |
sendObjectByFuture(java.lang.Object obj) |
void |
sendPartialBytes(java.nio.ByteBuffer partialByte,
boolean last) |
void |
sendPartialString(java.lang.String fragment,
boolean isLast) |
void |
sendPing(java.nio.ByteBuffer applicationData)
Send a ping message blocking until the message has been sent.
|
void |
sendPong(java.nio.ByteBuffer applicationData)
Send a pong message blocking until the message has been sent.
|
void |
sendString(java.lang.String text) |
void |
sendStringByCompletion(java.lang.String text,
SendHandler handler) |
java.util.concurrent.Future<java.lang.Void> |
sendStringByFuture(java.lang.String text) |
void |
setBatchingAllowed(boolean batchingAllowed)
Enable or disable the batching of outgoing messages for this endpoint.
|
protected void |
setEncoders(EndpointConfig endpointConfig) |
void |
setSendTimeout(long timeout) |
protected void |
setSession(WsSession wsSession) |
protected void |
setTransformation(Transformation transformation) |
protected void |
updateStats(long payloadLength)
Hook for updating server side statistics.
|
protected static final StringManager sm
protected static final SendResult SENDRESULT_OK
protected final java.util.concurrent.Semaphore messagePartInProgress
protected void setTransformation(Transformation transformation)
public long getSendTimeout()
public void setSendTimeout(long timeout)
public void setBatchingAllowed(boolean batchingAllowed)
throws java.io.IOException
javax.websocket.RemoteEndpointsetBatchingAllowed in interface RemoteEndpointbatchingAllowed - New settingjava.io.IOException - If changing the value resulted in a call to RemoteEndpoint.flushBatch() and that call threw an
IOException.public boolean getBatchingAllowed()
javax.websocket.RemoteEndpointgetBatchingAllowed in interface RemoteEndpointtrue if batching is enabled, otherwise false.public void flushBatch()
throws java.io.IOException
javax.websocket.RemoteEndpointflushBatch in interface RemoteEndpointjava.io.IOException - If an I/O error occurs while flushingpublic void sendBytes(java.nio.ByteBuffer data)
throws java.io.IOException
java.io.IOExceptionpublic java.util.concurrent.Future<java.lang.Void> sendBytesByFuture(java.nio.ByteBuffer data)
public void sendBytesByCompletion(java.nio.ByteBuffer data,
SendHandler handler)
public void sendPartialBytes(java.nio.ByteBuffer partialByte,
boolean last)
throws java.io.IOException
java.io.IOExceptionpublic void sendPing(java.nio.ByteBuffer applicationData)
throws java.io.IOException,
java.lang.IllegalArgumentException
javax.websocket.RemoteEndpointsendPing in interface RemoteEndpointapplicationData - The payload for the ping messagejava.io.IOException - If an I/O error occurs while sending the pingjava.lang.IllegalArgumentException - if the applicationData is too large for a control message (max 125 bytes)public void sendPong(java.nio.ByteBuffer applicationData)
throws java.io.IOException,
java.lang.IllegalArgumentException
javax.websocket.RemoteEndpointsendPong in interface RemoteEndpointapplicationData - The payload for the pong messagejava.io.IOException - If an I/O error occurs while sending the pongjava.lang.IllegalArgumentException - if the applicationData is too large for a control message (max 125 bytes)public void sendString(java.lang.String text)
throws java.io.IOException
java.io.IOExceptionpublic java.util.concurrent.Future<java.lang.Void> sendStringByFuture(java.lang.String text)
public void sendStringByCompletion(java.lang.String text,
SendHandler handler)
public void sendPartialString(java.lang.String fragment,
boolean isLast)
throws java.io.IOException
java.io.IOExceptionpublic java.io.OutputStream getSendStream()
public java.io.Writer getSendWriter()
protected boolean acquireMessagePartInProgressSemaphore(byte opCode,
long timeoutExpiry)
throws java.lang.InterruptedException
opCode - 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 updateStats(long payloadLength)
payloadLength - Size of message payloadpublic void sendObject(java.lang.Object obj)
throws java.io.IOException,
EncodeException
java.io.IOExceptionEncodeExceptionpublic java.util.concurrent.Future<java.lang.Void> sendObjectByFuture(java.lang.Object obj)
public void sendObjectByCompletion(java.lang.Object obj,
SendHandler completion)
protected void setSession(WsSession wsSession)
protected void setEncoders(EndpointConfig endpointConfig) throws DeploymentException
DeploymentExceptionpublic final void close()
protected abstract void doWrite(SendHandler handler, long blockingWriteTimeoutExpiry, java.nio.ByteBuffer... data)
protected abstract boolean isMasked()
protected abstract void doClose()
protected abstract java.util.concurrent.locks.Lock getLock()
Copyright © 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.