activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r599993 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
Date Fri, 30 Nov 2007 22:39:27 GMT
Author: chirino
Date: Fri Nov 30 14:39:26 2007
New Revision: 599993

URL: http://svn.apache.org/viewvc?rev=599993&view=rev
Log:
handle the inactivity actions in an async thread so that the schedular thread does not get
blocked.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java?rev=599993&r1=599992&r2=599993&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
Fri Nov 30 14:39:26 2007
@@ -74,13 +74,18 @@
 
         if (!commandSent.get()) {
             LOG.trace("No message sent since last write check, sending a KeepAliveInfo");
-            try {
-                synchronized (writeChecker) {
-                    next.oneway(new KeepAliveInfo());
-                }
-            } catch (IOException e) {
-                onException(e);
-            }
+            // TODO: use a thread pool for this..
+            Thread thread = new Thread("ActiveMQ: Activity Generator: "+next.getRemoteAddress())
{
+                public void run() {
+                    try {
+                        oneway(new KeepAliveInfo());
+                    } catch (IOException e) {
+                        onException(e);
+                    }
+                };
+            };
+            thread.setDaemon(true);
+            thread.start();
         } else {
             LOG.trace("Message sent since last write check, resetting flag");
         }
@@ -96,9 +101,18 @@
 
         if (!commandReceived.get()) {
             LOG.debug("No message received since last read check for " + toString() + "!
Throwing InactivityIOException.");
-            synchronized (readChecker) {
-                onException(new InactivityIOException("Channel was inactive for too long."));
-            }
+
+            // TODO: use a thread pool for this..
+            Thread thread = new Thread("ActiveMQ: Inactivity Handler: "+next.getRemoteAddress())
{
+                public void run() {
+                    synchronized (readChecker) {
+                        onException(new InactivityIOException("Channel was inactive for too
long: "+next.getRemoteAddress()));
+                    }
+                };
+            };
+            thread.setDaemon(true);
+            thread.start();
+
         } else {
             LOG.trace("Message received since last read check, resetting flag: ");
         }



Mime
View raw message