tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1703554 - /tomcat/trunk/java/org/apache/catalina/tribes/membership/McastService.java
Date Thu, 17 Sep 2015 10:13:34 GMT
Author: markt
Date: Thu Sep 17 10:13:33 2015
New Revision: 1703554

URL: http://svn.apache.org/r1703554
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58393
Fix multiple data races

Modified:
    tomcat/trunk/java/org/apache/catalina/tribes/membership/McastService.java

Modified: tomcat/trunk/java/org/apache/catalina/tribes/membership/McastService.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/membership/McastService.java?rev=1703554&r1=1703553&r2=1703554&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/tribes/membership/McastService.java (original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/membership/McastService.java Thu Sep 17 10:13:33
2015
@@ -62,7 +62,7 @@ public class McastService implements Mem
     /**
      * A membership listener delegate (should be the cluster :)
      */
-    protected MembershipListener listener;
+    protected volatile MembershipListener listener;
     /**
      * A message listener delegate for broadcasts
      */
@@ -459,7 +459,10 @@ public class McastService implements Mem
 
     @Override
     public void memberAdded(Member member) {
-        if ( listener!=null ) listener.memberAdded(member);
+        MembershipListener listener = this.listener;
+        if (listener != null) {
+            listener.memberAdded(member);
+        }
     }
 
     /**
@@ -467,9 +470,11 @@ public class McastService implements Mem
      * @param member The member
      */
     @Override
-    public void memberDisappeared(Member member)
-    {
-        if ( listener!=null ) listener.memberDisappeared(member);
+    public void memberDisappeared(Member member) {
+        MembershipListener listener = this.listener;
+        if (listener != null) {
+            listener.memberDisappeared(member);
+        }
     }
 
     @Override



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


Mime
View raw message