Author: kfujino Date: Tue Apr 19 09:23:56 2016 New Revision: 1739877 URL: http://svn.apache.org/viewvc?rev=1739877&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/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java tomcat/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java tomcat/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java tomcat/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java?rev=1739877&r1=1739876&r2=1739877&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java Tue Apr 19 09:23:56 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/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java?rev=1739877&r1=1739876&r2=1739877&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/MessageDispatchInterceptor.java Tue Apr 19 09:23:56 2016 @@ -110,9 +110,11 @@ public class MessageDispatchInterceptor if (run) { return; } + String channelName = ""; + if (getChannel().getName() != null) channelName = "[" + getChannel().getName() + "]"; executor = ExecutorFactory.newThreadPool(maxSpareThreads, maxThreads, keepAliveTime, TimeUnit.MILLISECONDS, - new TcclThreadFactory("MessageDispatchInterceptor.MessageDispatchThread")); + new TcclThreadFactory("MessageDispatchInterceptor.MessageDispatchThread" + channelName)); run = true; } Modified: tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java?rev=1739877&r1=1739876&r2=1739877&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java Tue Apr 19 09:23:56 2016 @@ -69,7 +69,9 @@ 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().getName() != null) channelName = "[" + getChannel().getName() + "]"; + thread.setName("TcpPingInterceptor.PingThread" + channelName +"-"+cnt.addAndGet(1)); thread.start(); } Modified: tomcat/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java?rev=1739877&r1=1739876&r2=1739877&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/membership/McastServiceImpl.java Tue Apr 19 09:23:56 2016 @@ -545,7 +545,9 @@ public class McastServiceImpl { int errorCounter = 0; public ReceiverThread() { super(); - setName("Tribes-MembershipReceiver"); + String channelName = ""; + if (channel.getName() != null) channelName = "[" + channel.getName() + "]"; + setName("Tribes-MembershipReceiver" + channelName); } @Override public void run() { @@ -578,7 +580,9 @@ public class McastServiceImpl { int errorCounter=0; public SenderThread(long time) { this.time = time; - setName("Tribes-MembershipSender"); + String channelName = ""; + if (channel.getName() != null) channelName = "[" + channel.getName() + "]"; + setName("Tribes-MembershipSender" + channelName); } @Override @@ -615,8 +619,9 @@ public class McastServiceImpl { } Thread t = new RecoveryThread(parent); - - t.setName("Tribes-MembershipRecovery"); + String channelName = ""; + if (parent.getChannel().getName() != null) channelName = "[" + parent.getChannel().getName() + "]"; + t.setName("Tribes-MembershipRecovery" + channelName); t.setDaemon(true); t.start(); } Modified: tomcat/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java?rev=1739877&r1=1739876&r2=1739877&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/transport/ReceiverBase.java Tue Apr 19 09:23:56 2016 @@ -89,7 +89,9 @@ 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.getName() != null) channelName = "[" + channel.getName() + "]"; + TaskThreadFactory tf = new TaskThreadFactory("Tribes-Task-Receiver" + channelName + "-"); executor = ExecutorFactory.newThreadPool(minThreads, maxThreads, maxIdleTime, TimeUnit.MILLISECONDS, tf); } } Modified: tomcat/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java?rev=1739877&r1=1739876&r2=1739877&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/transport/bio/BioReceiver.java Tue Apr 19 09:23:56 2016 @@ -53,7 +53,9 @@ public class BioReceiver extends Receive try { getBind(); bind(); - Thread t = new Thread(this, "BioReceiver"); + String channelName = ""; + if (getChannel().getName() != null) channelName = "[" + getChannel().getName() + "]"; + Thread t = new Thread(this, "BioReceiver" + channelName); t.setDaemon(true); t.start(); } catch (Exception x) { Modified: tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java?rev=1739877&r1=1739876&r2=1739877&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java Tue Apr 19 09:23:56 2016 @@ -88,7 +88,9 @@ public class NioReceiver extends Receive try { getBind(); bind(); - Thread t = new Thread(this, "NioReceiver"); + String channelName = ""; + if (getChannel().getName() != null) channelName = "[" + getChannel().getName() + "]"; + Thread t = new Thread(this, "NioReceiver" + channelName); t.setDaemon(true); t.start(); } catch (Exception x) { Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1739877&r1=1739876&r2=1739877&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Tue Apr 19 09:23:56 2016 @@ -270,6 +270,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