diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java b/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java index 6098ee5ed31..b0efe1753d4 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java @@ -35,9 +35,9 @@ import org.springframework.web.socket.WebSocketSession; * 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. + * thread will fail to acquire the flush lock 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. * * @author Rossen Stoyanchev * @since 4.0.3 @@ -69,6 +69,12 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat private final Lock closeLock = new ReentrantLock(); + /** + * Create a new {@code ConcurrentWebSocketSessionDecorator}. + * @param delegate the {@code WebSocketSession} to delegate to + * @param sendTimeLimit the send-time limit (milliseconds) + * @param bufferSizeLimit the buffer-size limit (number of bytes) + */ public ConcurrentWebSocketSessionDecorator(WebSocketSession delegate, int sendTimeLimit, int bufferSizeLimit) { super(delegate); this.sendTimeLimit = sendTimeLimit; diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java index e5446696c6a..425d6529f4d 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java @@ -52,22 +52,20 @@ import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSe /** * An implementation of {@link WebSocketHandler} that delegates incoming WebSocket - * messages to a {@link SubProtocolHandler} along with a {@link MessageChannel} to - * which the sub-protocol handler can send messages from WebSocket clients to - * the application. - *
- * Also an implementation of {@link MessageHandler} that finds the WebSocket - * session associated with the {@link Message} and passes it, along with the message, - * to the sub-protocol handler to send messages from the application back to the - * client. + * messages to a {@link SubProtocolHandler} along with a {@link MessageChannel} to which + * the sub-protocol handler can send messages from WebSocket clients to the application. + * + *
Also an implementation of {@link MessageHandler} that finds the WebSocket session
+ * associated with the {@link Message} and passes it, along with the message, to the
+ * sub-protocol handler to send messages from the application back to the client.
*
* @author Rossen Stoyanchev
* @author Andy Wilkinson
* @author Artem Bilan
* @since 4.0
*/
-public class SubProtocolWebSocketHandler implements WebSocketHandler,
- SubProtocolCapable, MessageHandler, SmartLifecycle {
+public class SubProtocolWebSocketHandler
+ implements WebSocketHandler, SubProtocolCapable, MessageHandler, SmartLifecycle {
/**
* Sessions connected to this handler use a sub-protocol. Hence we expect to
@@ -109,9 +107,14 @@ public class SubProtocolWebSocketHandler implements WebSocketHandler,
private volatile boolean running = false;
+ /**
+ * Create a new {@code SubProtocolWebSocketHandler} for the given inbound and outbound channels.
+ * @param clientInboundChannel the inbound {@code MessageChannel}
+ * @param clientOutboundChannel the outbound {@code MessageChannel}
+ */
public SubProtocolWebSocketHandler(MessageChannel clientInboundChannel, SubscribableChannel clientOutboundChannel) {
- Assert.notNull(clientInboundChannel, "ClientInboundChannel must not be null");
- Assert.notNull(clientOutboundChannel, "ClientOutboundChannel must not be null");
+ Assert.notNull(clientInboundChannel, "Inbound MessageChannel must not be null");
+ Assert.notNull(clientOutboundChannel, "Outbound MessageChannel must not be null");
this.clientInboundChannel = clientInboundChannel;
this.clientOutboundChannel = clientOutboundChannel;
}
@@ -125,7 +128,7 @@ public class SubProtocolWebSocketHandler implements WebSocketHandler,
public void setProtocolHandlers(List