tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1703763 - in /tomcat/trunk/java/org/apache/catalina/tribes/transport: AbstractSender.java nio/PooledParallelSender.java
Date Fri, 18 Sep 2015 08:22:11 GMT
Author: markt
Date: Fri Sep 18 08:22:11 2015
New Revision: 1703763

URL: http://svn.apache.org/viewvc?rev=1703763&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58397
Remove unnecessary duplicated connected field and fix a rare data race on close.

Modified:
    tomcat/trunk/java/org/apache/catalina/tribes/transport/AbstractSender.java
    tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java

Modified: tomcat/trunk/java/org/apache/catalina/tribes/transport/AbstractSender.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/transport/AbstractSender.java?rev=1703763&r1=1703762&r2=1703763&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/tribes/transport/AbstractSender.java (original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/transport/AbstractSender.java Fri Sep 18
08:22:11 2015
@@ -24,7 +24,7 @@ import org.apache.catalina.tribes.Member
 
 public abstract class AbstractSender implements DataSender {
 
-    private boolean connected = false;
+    private volatile boolean connected = false;
     private int rxBufSize = 25188;
     private int txBufSize = 43800;
     private int udpRxBufSize = 25188;

Modified: tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java?rev=1703763&r1=1703762&r2=1703763&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java (original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java Fri
Sep 18 08:22:11 2015
@@ -29,14 +29,11 @@ import org.apache.catalina.tribes.util.S
 public class PooledParallelSender extends PooledSender {
     protected static final StringManager sm = StringManager.getManager(PooledParallelSender.class);
 
-    protected boolean connected = true;
-    public PooledParallelSender() {
-        super();
-    }
-
     @Override
     public void sendMessage(Member[] destination, ChannelMessage message) throws ChannelException
{
-        if ( !connected ) throw new ChannelException(sm.getString("pooledParallelSender.sender.disconnected"));
+        if (!isConnected()) {
+            throw new ChannelException(sm.getString("pooledParallelSender.sender.disconnected"));
+        }
         ParallelNioSender sender = (ParallelNioSender)getSender();
         if (sender == null) {
             ChannelException cx = new ChannelException(sm.getString(
@@ -54,7 +51,6 @@ public class PooledParallelSender extend
                 throw x;
             } finally {
                 returnSender(sender);
-                if (!connected) disconnect();
             }
         }
     }
@@ -69,17 +65,4 @@ public class PooledParallelSender extend
             throw new RuntimeException(sm.getString("pooledParallelSender.unable.open"),x);
         }
     }
-
-    @Override
-    public synchronized void disconnect() {
-        this.connected = false;
-        super.disconnect();
-    }
-
-    @Override
-    public synchronized void connect() throws IOException {
-        this.connected = true;
-        super.connect();
-    }
-
 }
\ No newline at end of file



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


Mime
View raw message