public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorator
WebSocketSession
and guarantees
only one thread can send messages at a time.
If a send is slow, subsequent attempts to send more messages from a different thread will fail to acquire the flushLock and the messages will be buffered instead -- at that time the specified buffer size limit and send time limit will be checked and the session closed if the limits are exceeded.
Constructor and Description |
---|
ConcurrentWebSocketSessionDecorator(WebSocketSession delegate,
int sendTimeLimit,
int bufferSizeLimit) |
Modifier and Type | Method and Description |
---|---|
int |
getBufferSize() |
long |
getTimeSinceSendStarted() |
void |
sendMessage(WebSocketMessage<?> message)
Send a WebSocket message either
TextMessage or
BinaryMessage . |
close, close, getAcceptedProtocol, getAttributes, getBinaryMessageSizeLimit, getDelegate, getExtensions, getHandshakeHeaders, getId, getLastSession, getLocalAddress, getPrincipal, getRemoteAddress, getTextMessageSizeLimit, getUri, isOpen, setBinaryMessageSizeLimit, setTextMessageSizeLimit, toString, unwrap
public ConcurrentWebSocketSessionDecorator(WebSocketSession delegate, int sendTimeLimit, int bufferSizeLimit)
public int getBufferSize()
public long getTimeSinceSendStarted()
public void sendMessage(WebSocketMessage<?> message) throws IOException
WebSocketSession
TextMessage
or
BinaryMessage
.sendMessage
in interface WebSocketSession
sendMessage
in class WebSocketSessionDecorator
IOException