activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1387989 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: broker/BrokerService.java transport/AbstractInactivityMonitor.java
Date Thu, 20 Sep 2012 12:02:04 GMT
Author: davsclaus
Date: Thu Sep 20 12:02:04 2012
New Revision: 1387989

URL: http://svn.apache.org/viewvc?rev=1387989&view=rev
Log:
AMQ-4067: Prefix thread names with ActiveMQ

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1387989&r1=1387988&r2=1387989&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Thu Sep 20 12:02:04 2012
@@ -1181,7 +1181,7 @@ public class BrokerService implements Se
 
     public TaskRunnerFactory getTaskRunnerFactory() {
         if (this.taskRunnerFactory == null) {
-            this.taskRunnerFactory = new TaskRunnerFactory("BrokerService["+getBrokerName()+"]
Task", getTaskRunnerPriority(), true, 1000,
+            this.taskRunnerFactory = new TaskRunnerFactory("ActiveMQ BrokerService["+getBrokerName()+"]
Task", getTaskRunnerPriority(), true, 1000,
                     isDedicatedTaskRunner());
         }
         return this.taskRunnerFactory;
@@ -2550,7 +2550,7 @@ public class BrokerService implements Se
                 @Override
                 public Thread newThread(Runnable runnable) {
                     this.i++;
-                    Thread thread = new Thread(runnable, "BrokerService.worker." + this.i);
+                    Thread thread = new Thread(runnable, "ActiveMQ BrokerService.worker."
+ this.i);
                     thread.setDaemon(true);
                     thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()
{
                         @Override

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java?rev=1387989&r1=1387988&r2=1387989&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java
Thu Sep 20 12:02:04 2012
@@ -94,6 +94,11 @@ public abstract class AbstractInactivity
             lastRunTime = now;
             readCheck();
         }
+
+        @Override
+        public String toString() {
+            return "ReadChecker";
+        }
     };
 
     private boolean allowReadCheck(long elapsed) {
@@ -111,6 +116,11 @@ public abstract class AbstractInactivity
             lastRunTime = now;
             writeCheck();
         }
+
+        @Override
+        public String toString() {
+            return "WriteChecker";
+        }
     };
 
     public AbstractInactivityMonitor(Transport next, WireFormat wireFormat) {
@@ -142,6 +152,9 @@ public abstract class AbstractInactivity
             }
             ASYNC_TASKS.execute(new Runnable() {
                 public void run() {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Running {}", this);
+                    }
                     if (monitorStarted.get()) {
                         try {
                             // If we can't get the lock it means another write beat us into
the
@@ -159,6 +172,11 @@ public abstract class AbstractInactivity
                              }
                         }
                     }
+                }
+
+                @Override
+                public String toString() {
+                    return "WriteCheck[" + getRemoteAddress() + "]";
                 };
             });
         } else {
@@ -185,7 +203,15 @@ public abstract class AbstractInactivity
             }
             ASYNC_TASKS.execute(new Runnable() {
                 public void run() {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Running {}", this);
+                    }
                     onException(new InactivityIOException("Channel was inactive for too (>"
+ readCheckTime + ") long: "+next.getRemoteAddress()));
+                }
+
+                @Override
+                public String toString() {
+                    return "ReadCheck[" + getRemoteAddress() + "]";
                 };
             });
         } else {
@@ -332,8 +358,8 @@ public abstract class AbstractInactivity
             synchronized(AbstractInactivityMonitor.class) {
                 if( CHECKER_COUNTER == 0 ) {
                     ASYNC_TASKS = createExecutor();
-                    READ_CHECK_TIMER = new Timer("InactivityMonitor ReadCheck",true);
-                    WRITE_CHECK_TIMER = new Timer("InactivityMonitor WriteCheck",true);
+                    READ_CHECK_TIMER = new Timer("ActiveMQ InactivityMonitor ReadCheckTimer",true);
+                    WRITE_CHECK_TIMER = new Timer("ActiveMQ InactivityMonitor WriteCheckTimer",true);
                 }
                 CHECKER_COUNTER++;
                 if (readCheckTime > 0) {
@@ -374,13 +400,15 @@ public abstract class AbstractInactivity
 
     private ThreadFactory factory = new ThreadFactory() {
         public Thread newThread(Runnable runnable) {
-            Thread thread = new Thread(runnable, "InactivityMonitor Async Task: "+runnable);
+            Thread thread = new Thread(runnable, "ActiveMQ InactivityMonitor Worker");
             thread.setDaemon(true);
             return thread;
         }
     };
 
     private ThreadPoolExecutor createExecutor() {
+        // TODO: This value of 10 seconds seems to low, see discussion at
+        // http://activemq.2283324.n4.nabble.com/InactivityMonitor-Creating-too-frequent-threads-tp4656752.html;cid=1348142445209-351
         ThreadPoolExecutor exec = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 10, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(), factory);
         exec.allowCoreThreadTimeOut(true);
         return exec;



Mime
View raw message