You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2007/01/19 23:55:04 UTC

svn commit: r497992 - in /incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing: RequestManager.java ResponseManager.java

Author: rhs
Date: Fri Jan 19 14:55:03 2007
New Revision: 497992

URL: http://svn.apache.org/viewvc?view=rev&rev=497992
Log:
replaced Hashtable with ConcurrentHashMap to solve intermittant ConcurrentModificationException

Modified:
    incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/RequestManager.java
    incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java

Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/RequestManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/RequestManager.java?view=diff&rev=497992&r1=497991&r2=497992
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/RequestManager.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/RequestManager.java Fri Jan 19 14:55:03 2007
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.framing;
 
-import java.util.Hashtable;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.qpid.protocol.AMQMethodEvent;
 import org.apache.qpid.protocol.AMQMethodListener;
@@ -43,7 +43,7 @@
      */
     private long lastProcessedResponseId;
 
-    private Hashtable<Long, AMQMethodListener> requestSentMap;
+    private ConcurrentHashMap<Long, AMQMethodListener> requestSentMap;
 
     public RequestManager(int channel, AMQProtocolWriter protocolWriter)
     {
@@ -51,7 +51,7 @@
         this.protocolWriter = protocolWriter;
         requestIdCount = 1L;
         lastProcessedResponseId = 0L;
-        requestSentMap = new Hashtable<Long, AMQMethodListener>();
+        requestSentMap = new ConcurrentHashMap<Long, AMQMethodListener>();
     }
 
     // *** Functions to originate a request ***

Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java?view=diff&rev=497992&r1=497991&r2=497992
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java Fri Jan 19 14:55:03 2007
@@ -21,7 +21,7 @@
 package org.apache.qpid.framing;
 
 import java.util.Iterator;
-import java.util.Hashtable;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.qpid.AMQException;
 import org.apache.qpid.protocol.AMQMethodEvent;
@@ -88,7 +88,7 @@
         }
     }
 
-    private Hashtable<Long, ResponseStatus> responseMap;
+    private ConcurrentHashMap<Long, ResponseStatus> responseMap;
 
     public ResponseManager(int channel, AMQMethodListener methodListener,
         AMQProtocolWriter protocolWriter)
@@ -98,7 +98,7 @@
         this.protocolWriter = protocolWriter;
         responseIdCount = 1L;
         lastReceivedRequestId = 0L;
-        responseMap = new Hashtable<Long, ResponseStatus>();
+        responseMap = new ConcurrentHashMap<Long, ResponseStatus>();
     }
 
     // *** Functions to handle an incoming request ***
@@ -193,7 +193,7 @@
         return responseIdCount++;
     }
 
-    private void doBatches()
+    private synchronized void doBatches()
     {
         switch (batchResponseMode)
         {