You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/11/30 23:39:27 UTC
svn commit: r599993 -
/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
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: ");
}