activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r585932 - /activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
Date Thu, 18 Oct 2007 11:26:08 GMT
Author: jlim
Date: Thu Oct 18 04:26:07 2007
New Revision: 585932

URL: http://svn.apache.org/viewvc?rev=585932&view=rev
Log:
applied patch for AMQ-1302

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

Modified: activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java?rev=585932&r1=585931&r2=585932&view=diff
==============================================================================
--- activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
(original)
+++ activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
Thu Oct 18 04:26:07 2007
@@ -70,86 +70,83 @@
 
         
     private void writeCheck() {
-        synchronized(writeChecker) {
-            if( inSend.get() ) {
-                log.trace("A send is in progress");
-                return;
-            }
-
-            if( !commandSent.get() ) {
-                log.trace("No message sent since last write check, sending a KeepAliveInfo");
-                try {
-                    next.oneway(new KeepAliveInfo());
-                } catch (IOException e) {
-                    onException(e);
-                }
-            } else {
-                log.trace("Message sent since last write check, resetting flag");
-            }
 
-            commandSent.set(false);
+        if( inSend.get() ) {
+            log.trace("A send is in progress");
+            return;
         }
-    }
 
-    private void readCheck() {
-        synchronized(readChecker) {
-            if( inReceive.get() ) {
-                log.trace("A receive is in progress");
-                return;
+        if( !commandSent.get() ) {
+            log.trace("No message sent since last write check, sending a KeepAliveInfo");
+            try {
+                 next.oneway(new KeepAliveInfo());
+            } catch (IOException e) {
+                 onException(e);
             }
+        } else {
+            log.trace("Message sent since last write check, resetting flag");
+        }
 
-            if( !commandReceived.get() ) {
-                log.debug("No message received since last read check for " + toString() +
"! Throwing InactivityIOException.");
-                onException(new InactivityIOException("Channel was inactive for too long."));
-            } else {
-                log.trace("Message received since last read check, resetting flag: ");
-            }
+        commandSent.set(false);
 
-            commandReceived.set(false);
-        }
+    }
+
+    private void readCheck() {
+         if( inReceive.get() ) {
+             log.trace("A receive is in progress");
+             return;
+         }
+
+         if( !commandReceived.get() ) {
+             log.debug("No message received since last read check for " + toString() + "!
Throwing InactivityIOException.");
+             onException(new InactivityIOException("Channel was inactive for too long."));
+         } else {
+             log.trace("Message received since last read check, resetting flag: ");
+         }
+         commandReceived.set(false);
 
     }
 
     public void onCommand(Object command) {
-        synchronized(readChecker) {
-            inReceive.set(true);
-            try {
-                if( command.getClass() == WireFormatInfo.class ) {
-                    synchronized( this ) {
-                        remoteWireFormatInfo = (WireFormatInfo) command;
-                        try {
-                            startMonitorThreads();
-                        } catch (IOException e) {
-                            onException(e);
-                        }
+
+         inReceive.set(true);
+         try {
+             if( command.getClass() == WireFormatInfo.class ) {
+                 synchronized( this ) {
+                    remoteWireFormatInfo = (WireFormatInfo) command;
+                    try {
+                         startMonitorThreads();
+                    } catch (IOException e) {
+                         onException(e);
                     }
                 }
-                transportListener.onCommand(command);
-            } finally {
-                inReceive.set(false);
-                commandReceived.set(true);
-            }
-        }
+             }
+             transportListener.onCommand(command);
+         } finally {
+             inReceive.set(false);
+             commandReceived.set(true);
+         }
+     
     }
 
     
     public void oneway(Object o) throws IOException {
-        synchronized(writeChecker) {
-            // Disable inactivity monitoring while processing a command.
-            inSend.set(true);
-            commandSent.set(true);
-            try {
-                if( o.getClass() == WireFormatInfo.class ) {
-                    synchronized( this ) {
-                        localWireFormatInfo = (WireFormatInfo) o;
-                        startMonitorThreads();
-                    }
-                }
-                next.oneway(o);
-            } finally {
-                inSend.set(false);
-            }
-        }
+     
+          // Disable inactivity monitoring while processing a command.
+          inSend.set(true);
+          commandSent.set(true);
+          try {
+              if( o.getClass() == WireFormatInfo.class ) {
+                  synchronized( this ) {
+                     localWireFormatInfo = (WireFormatInfo) o;
+                     startMonitorThreads();
+                  }
+              }
+              next.oneway(o);
+          } finally {
+              inSend.set(false);
+          }
+
     }
     
     public void onException(IOException error) {



Mime
View raw message