Author: kfujino
Date: Tue Apr 19 09:27:01 2016
New Revision: 1739879

URL: http://svn.apache.org/viewvc?rev=1739879&view=rev
Log:
Add the channel name to the thread which is invoked by channel services in 
order to identify the associated channel.

Modified:
    tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java
    
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java
    
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
    
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
    
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java
    
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java
    
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java
    tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java?rev=1739879&r1=1739878&r2=1739879&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java 
(original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java 
Tue Apr 19 09:27:01 2016
@@ -695,7 +695,9 @@ public class GroupChannel extends Channe
         public HeartbeatThread(GroupChannel channel, long sleepTime) {
             super();
             this.setPriority(MIN_PRIORITY);
-            setName("GroupChannel-Heartbeat-"+inc());
+            String channelName = "";
+            if (channel.getName() != null) channelName = "[" + 
channel.getName() + "]";
+            setName("GroupChannel-Heartbeat" + channelName + "-" +inc());
             setDaemon(true);
             this.channel = channel;
             this.sleepTime = sleepTime;

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java?rev=1739879&r1=1739878&r2=1739879&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java
 Tue Apr 19 09:27:01 2016
@@ -27,6 +27,7 @@ import org.apache.catalina.tribes.ErrorH
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.UniqueId;
 import org.apache.catalina.tribes.group.ChannelInterceptorBase;
+import org.apache.catalina.tribes.group.GroupChannel;
 import org.apache.catalina.tribes.group.InterceptorPayload;
 import org.apache.catalina.tribes.util.ExecutorFactory;
 import org.apache.catalina.tribes.util.StringManager;
@@ -134,9 +135,13 @@ public class MessageDispatchInterceptor
         if (run) {
             return;
         }
+        String channelName = "";
+        if (getChannel() instanceof GroupChannel && 
((GroupChannel)getChannel()).getName() != null) {
+            channelName = "[" + ((GroupChannel)getChannel()).getName() + "]";
+        }
         executor = ExecutorFactory.newThreadPool(maxSpareThreads, maxThreads, 
keepAliveTime,
                 TimeUnit.MILLISECONDS,
-                new 
TcclThreadFactory("MessageDispatchInterceptor.MessageDispatchThread"));
+                new 
TcclThreadFactory("MessageDispatchInterceptor.MessageDispatchThread" + 
channelName));
         run = true;
     }
 

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java?rev=1739879&r1=1739878&r2=1739879&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
 Tue Apr 19 09:27:01 2016
@@ -26,6 +26,7 @@ import org.apache.catalina.tribes.Channe
 import org.apache.catalina.tribes.ChannelMessage;
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.group.ChannelInterceptorBase;
+import org.apache.catalina.tribes.group.GroupChannel;
 import org.apache.catalina.tribes.io.ChannelData;
 import org.apache.catalina.tribes.io.XByteBuffer;
 import org.apache.catalina.tribes.util.StringManager;
@@ -70,7 +71,12 @@ public class TcpPingInterceptor extends
         if ( thread == null && useThread) {
             thread = new PingThread();
             thread.setDaemon(true);
-            thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
+            String channelName = "";
+            if (getChannel() instanceof GroupChannel
+                    && ((GroupChannel)getChannel()).getName() != null) {
+                channelName = "[" + ((GroupChannel)getChannel()).getName() + 
"]";
+            }
+            thread.setName("TcpPingInterceptor.PingThread" + channelName 
+"-"+cnt.addAndGet(1));
             thread.start();
         }
 

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java?rev=1739879&r1=1739878&r2=1739879&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
 Tue Apr 19 09:27:01 2016
@@ -34,6 +34,7 @@ import org.apache.catalina.tribes.Channe
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.MembershipListener;
 import org.apache.catalina.tribes.MessageListener;
+import org.apache.catalina.tribes.group.GroupChannel;
 import org.apache.catalina.tribes.io.ChannelData;
 import org.apache.catalina.tribes.io.XByteBuffer;
 import org.apache.catalina.tribes.util.ExecutorFactory;
@@ -540,7 +541,11 @@ public class McastServiceImpl
         int errorCounter = 0;
         public ReceiverThread() {
             super();
-            setName("Tribes-MembershipReceiver");
+            String channelName = "";
+            if (channel instanceof GroupChannel && 
((GroupChannel)channel).getName() != null) {
+                channelName = "[" + ((GroupChannel)channel).getName() + "]";
+            }
+            setName("Tribes-MembershipReceiver" + channelName);
         }
         @Override
         public void run() {
@@ -573,7 +578,11 @@ public class McastServiceImpl
         int errorCounter=0;
         public SenderThread(long time) {
             this.time = time;
-            setName("Tribes-MembershipSender");
+            String channelName = "";
+            if (channel instanceof GroupChannel && 
((GroupChannel)channel).getName() != null) {
+                channelName = "[" + ((GroupChannel)channel).getName() + "]";
+            }
+            setName("Tribes-MembershipSender" + channelName);
 
         }
         @Override
@@ -610,8 +619,12 @@ public class McastServiceImpl
             }
 
             Thread t = new RecoveryThread(parent);
-
-            t.setName("Tribes-MembershipRecovery");
+            String channelName = "";
+            if (parent.getChannel() instanceof GroupChannel
+                    && ((GroupChannel)parent.getChannel()).getName() != null) {
+                channelName = "[" + 
((GroupChannel)parent.getChannel()).getName() + "]";
+            }
+            t.setName("Tribes-MembershipRecovery" + channelName);
             t.setDaemon(true);
             t.start();
         }

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java?rev=1739879&r1=1739878&r2=1739879&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java
 Tue Apr 19 09:27:01 2016
@@ -30,6 +30,7 @@ import org.apache.catalina.tribes.Channe
 import org.apache.catalina.tribes.ChannelMessage;
 import org.apache.catalina.tribes.ChannelReceiver;
 import org.apache.catalina.tribes.MessageListener;
+import org.apache.catalina.tribes.group.GroupChannel;
 import org.apache.catalina.tribes.io.ListenCallback;
 import org.apache.catalina.tribes.util.ExecutorFactory;
 import org.apache.catalina.tribes.util.StringManager;
@@ -89,7 +90,11 @@ public abstract class ReceiverBase imple
     public void start() throws IOException {
         if ( executor == null ) {
             //executor = new 
ThreadPoolExecutor(minThreads,maxThreads,60,TimeUnit.SECONDS,new 
LinkedBlockingQueue<Runnable>());
-            TaskThreadFactory tf = new 
TaskThreadFactory("Tribes-Task-Receiver-");
+            String channelName = "";
+            if (channel instanceof GroupChannel && 
((GroupChannel)channel).getName() != null) {
+                channelName = "[" + ((GroupChannel)channel).getName() + "]";
+            }
+            TaskThreadFactory tf = new 
TaskThreadFactory("Tribes-Task-Receiver" + channelName + "-");
             executor = ExecutorFactory.newThreadPool(minThreads, maxThreads, 
maxIdleTime, TimeUnit.MILLISECONDS, tf);
         }
     }

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java?rev=1739879&r1=1739878&r2=1739879&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java
 Tue Apr 19 09:27:01 2016
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.Socket;
 
+import org.apache.catalina.tribes.group.GroupChannel;
 import org.apache.catalina.tribes.io.ObjectReader;
 import org.apache.catalina.tribes.transport.AbstractRxTask;
 import org.apache.catalina.tribes.transport.ReceiverBase;
@@ -54,7 +55,12 @@ public class BioReceiver extends Receive
         try {
             getBind();
             bind();
-            Thread t = new Thread(this, "BioReceiver");
+            String channelName = "";
+            if (getChannel() instanceof GroupChannel
+                    && ((GroupChannel)getChannel()).getName() != null) {
+                channelName = "[" + ((GroupChannel)getChannel()).getName() + 
"]";
+            }
+            Thread t = new Thread(this, "BioReceiver" + channelName);
             t.setDaemon(true);
             t.start();
         } catch (Exception x) {

Modified: 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java?rev=1739879&r1=1739878&r2=1739879&view=diff
==============================================================================
--- 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java
 (original)
+++ 
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java
 Tue Apr 19 09:27:01 2016
@@ -33,6 +33,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.concurrent.atomic.AtomicReference;
 
+import org.apache.catalina.tribes.group.GroupChannel;
 import org.apache.catalina.tribes.io.ObjectReader;
 import org.apache.catalina.tribes.transport.AbstractRxTask;
 import org.apache.catalina.tribes.transport.ReceiverBase;
@@ -89,7 +90,12 @@ public class NioReceiver extends Receive
         try {
             getBind();
             bind();
-            Thread t = new Thread(this, "NioReceiver");
+            String channelName = "";
+            if (getChannel() instanceof GroupChannel
+                    && ((GroupChannel)getChannel()).getName() != null) {
+                channelName = "[" + ((GroupChannel)getChannel()).getName() + 
"]";
+            }
+            Thread t = new Thread(this, "NioReceiver" + channelName);
             t.setDaemon(true);
             t.start();
         } catch (Exception x) {

Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1739879&r1=1739878&r2=1739879&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Tue Apr 19 09:27:01 2016
@@ -225,6 +225,10 @@
         environment, it is set the cluster name + "-Channel" as default value.
         (kfujino)
       </add>
+      <add>
+        Add the channel name to the thread which is invoked by channel services
+        in order to identify the associated channel. (kfujino)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Other">



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

Reply via email to