Author: markt
Date: Tue Jul  2 13:20:59 2013
New Revision: 1498920

URL: http://svn.apache.org/r1498920
Log:
Refactor

Modified:
    
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java?rev=1498920&r1=1498919&r2=1498920&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
 (original)
+++ 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
 Tue Jul  2 13:20:59 2013
@@ -106,9 +106,7 @@ public class WsRemoteEndpointImplServer 
         } catch (IOException ioe) {
             wsWriteTimeout.unregister(this);
             close();
-            SendHandler sh = handler;
-            handler = null;
-            sh.onResult(new SendResult(ioe));
+            clearHandler(ioe);
         }
         if (!complete) {
             // Async write is in progress
@@ -143,7 +141,13 @@ public class WsRemoteEndpointImplServer 
 
     protected void onTimeout() {
         close();
-        handler.onResult(new SendResult(new SocketTimeoutException()));
+        clearHandler(new SocketTimeoutException());
+    }
+
+
+    private void clearHandler(Throwable t) {
+        SendHandler sh = handler;
         handler = null;
+        sh.onResult(new SendResult(t));
     }
 }



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

Reply via email to