You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/02/15 17:45:30 UTC

svn commit: r1446681 - in /tomcat/trunk/java: javax/websocket/RemoteEndpoint.java org/apache/tomcat/websocket/LocalStrings.properties org/apache/tomcat/websocket/WsRemoteEndpointBase.java

Author: markt
Date: Fri Feb 15 16:45:29 2013
New Revision: 1446681

URL: http://svn.apache.org/r1446681
Log:
setBatchingAllowed() will throw IOE in next spec iteration

Modified:
    tomcat/trunk/java/javax/websocket/RemoteEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
    tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java

Modified: tomcat/trunk/java/javax/websocket/RemoteEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/websocket/RemoteEndpoint.java?rev=1446681&r1=1446680&r2=1446681&view=diff
==============================================================================
--- tomcat/trunk/java/javax/websocket/RemoteEndpoint.java (original)
+++ tomcat/trunk/java/javax/websocket/RemoteEndpoint.java Fri Feb 15 16:45:29 2013
@@ -31,8 +31,11 @@ public interface RemoteEndpoint {
      * block until any currently batched messages have been written.
      *
      * @param batchingAllowed   New setting
+     * @throws IOException      If changing the value resulted in a call to
+     *                          {@link #flushBatch()} and that call threw an
+     *                          {@link IOException}.
      */
-    void setBatchingAllowed(boolean batchingAllowed);
+    void setBatchingAllowed(boolean batchingAllowed) throws IOException;
 
     /**
      * Obtains the current batching status of the endpoint.

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1446681&r1=1446680&r2=1446681&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Fri Feb 15 16:45:29 2013
@@ -34,6 +34,7 @@ wsFrame.wrongRsv=The client frame set th
 wsRemoteEndpoint.closed=Message will not be sent because the WebSocket session has been closed
 wsRemoteEndpoint.changeType=When sending a fragmented message, all fragments bust be of the same type
 wsRemoteEndpoint.concurrentMessageSend=Messages may not be sent concurrently even when using the asynchronous send messages. The client must wait for the previous message to complete before sending the next.
+wsRemoteEndpoint.flushOnCloseFailed=Flushing batched messages before closing the session failed
 wsRemoteEndpoint.inProgress=Message will not be sent because the WebSocket session is currently sending another message
 
 # Note the following message is used as a close reason in a WebSocket control

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java?rev=1446681&r1=1446680&r2=1446681&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointBase.java Fri Feb 15 16:45:29 2013
@@ -45,6 +45,10 @@ public abstract class WsRemoteEndpointBa
     private static final StringManager sm =
             StringManager.getManager(Constants.PACKAGE_NAME);
 
+    private static org.apache.juli.logging.Log log =
+            org.apache.juli.logging.LogFactory.getLog(
+                    WsRemoteEndpointBase.class);
+
     private boolean messagePartInProgress = false;
     private Queue<MessagePart> messagePartQueue = new ArrayDeque<>();
     private final Object messagePartLock = new Object();
@@ -80,16 +84,11 @@ public abstract class WsRemoteEndpointBa
 
 
     @Override
-    public void setBatchingAllowed(boolean batchingAllowed) {
+    public void setBatchingAllowed(boolean batchingAllowed) throws IOException {
         boolean oldValue = this.batchingAllowed.getAndSet(batchingAllowed);
 
         if (oldValue && !batchingAllowed) {
-            // Just disabled batched. Must flush.
-            try {
-                flushBatch();
-            } catch (IOException e) {
-                // TODO Log this? Runtime exception? Something else?
-            }
+            flushBatch();
         }
     }
 
@@ -234,7 +233,12 @@ public abstract class WsRemoteEndpointBa
 
         synchronized (messagePartLock) {
             if (Constants.OPCODE_CLOSE == mp.getOpCode()) {
-                setBatchingAllowed(false);
+                try {
+                    setBatchingAllowed(false);
+                } catch (IOException e) {
+                    log.warn(sm.getString(
+                            "wsRemoteEndpoint.flushOnCloseFailed"), e);
+                }
             }
             if (messagePartInProgress) {
                 if (!Util.isControl(opCode)) {
@@ -419,33 +423,6 @@ public abstract class WsRemoteEndpointBa
     }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     @Override
     public void sendObject(Object o) throws IOException, EncodeException {
         // TODO Auto-generated method stub



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org