activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r638814 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
Date Wed, 19 Mar 2008 12:34:43 GMT
Author: rajdavies
Date: Wed Mar 19 05:34:40 2008
New Revision: 638814

URL: http://svn.apache.org/viewvc?rev=638814&view=rev
Log:
synchronize oneway()

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=638814&r1=638813&r2=638814&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
Wed Mar 19 05:34:40 2008
@@ -23,8 +23,6 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
 import org.apache.activemq.command.KeepAliveInfo;
 import org.apache.activemq.command.WireFormatInfo;
 import org.apache.activemq.thread.SchedulerTimerTask;
@@ -214,21 +212,26 @@
 
     public void oneway(Object o) throws IOException {
         // Disable inactivity monitoring while processing a command.
-        inSend.set(true);
-        try {
-            if (o.getClass() == WireFormatInfo.class) {
-                synchronized (this) {
-                    localWireFormatInfo = (WireFormatInfo)o;
-                    startMonitorThreads();
+        //synchronize this method - its not synchronized
+        //further down the transport stack and gets called by more 
+        //than one thread  by this class
+        synchronized(inSend) {
+            inSend.set(true);
+            try {
+                if (o.getClass() == WireFormatInfo.class) {
+                    synchronized (this) {
+                        localWireFormatInfo = (WireFormatInfo)o;
+                        startMonitorThreads();
+                    }
                 }
+                if( inactive.get() ) {
+                    throw new InactivityIOException("Channel was inactive for too long: "+next.getRemoteAddress());
+                }
+                next.oneway(o);
+            } finally {
+                commandSent.set(true);
+                inSend.set(false);
             }
-            if( inactive.get() ) {
-                throw new InactivityIOException("Channel was inactive for too long: "+next.getRemoteAddress());
-            }
-            next.oneway(o);
-        } finally {
-            commandSent.set(true);
-            inSend.set(false);
         }
     }
 



Mime
View raw message