tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfuj...@apache.org
Subject svn commit: r1843880 - /tomcat/trunk/java/org/apache/catalina/tribes/membership/cloud/CloudMembershipProvider.java
Date Mon, 15 Oct 2018 07:26:58 GMT
Author: kfujino
Date: Mon Oct 15 07:26:58 2018
New Revision: 1843880

URL: http://svn.apache.org/viewvc?rev=1843880&view=rev
Log:
Use executor.
The event notification of memberAdded or memberDisappeared does not prevent execution of the
original thread.

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

Modified: tomcat/trunk/java/org/apache/catalina/tribes/membership/cloud/CloudMembershipProvider.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/membership/cloud/CloudMembershipProvider.java?rev=1843880&r1=1843879&r2=1843880&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/tribes/membership/cloud/CloudMembershipProvider.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/membership/cloud/CloudMembershipProvider.java
Mon Oct 15 07:26:58 2018
@@ -111,7 +111,19 @@ public abstract class CloudMembershipPro
                 if (log.isDebugEnabled()) {
                     log.debug("Member added: " + member);
                 }
-                membershipListener.memberAdded(member);
+                Runnable r = new Runnable() {
+                    @Override
+                    public void run(){
+                        String name = Thread.currentThread().getName();
+                        try {
+                            Thread.currentThread().setName("CloudMembership-memberAdded");
+                            membershipListener.memberAdded(member);
+                        } finally {
+                            Thread.currentThread().setName(name);
+                        }
+                    }
+                };
+                executor.execute(r);
             }
         }
         // Remove non refreshed members from the membership
@@ -120,7 +132,19 @@ public abstract class CloudMembershipPro
             if (log.isDebugEnabled()) {
                 log.debug("Member disappeared: " + member);
             }
-            membershipListener.memberDisappeared(member);
+            Runnable r = new Runnable() {
+                @Override
+                public void run(){
+                    String name = Thread.currentThread().getName();
+                    try {
+                        Thread.currentThread().setName("CloudMembership-memberDisappeared");
+                        membershipListener.memberDisappeared(member);
+                    } finally {
+                        Thread.currentThread().setName(name);
+                    }
+                }
+            };
+            executor.execute(r);
         }
     }
 



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


Mime
View raw message