User: hiram
Date: 01/01/13 21:44:21
Modified: src/java/org/spydermq SpySession.java
Log:
Bug Fix: for the bug Tom Rose found:
Got this exception when trying to close a TopicConnection, any ideas?
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.next(HashMap.java:736)
at org.spydermq.SpySession.close(SpySession.java:271)
at com.ikonect.util.JMSUtil.closeConnection(JMSUtil.java:367)
at com.ikonect.util.proxy.JMSService.removeContext
(JMSService.java:161)
at com.ikonect.util.proxy.JMSService.proxyRequest
(JMSService.java:101)
at com.ikonect.util.iListenThread.run(iListenThread.java:80)
at java.lang.Thread.run(Thread.java:484)
Revision Changes Path
1.25 +18 -12 spyderMQ/src/java/org/spydermq/SpySession.java
Index: SpySession.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpySession.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- SpySession.java 2001/01/08 21:47:24 1.24
+++ SpySession.java 2001/01/14 05:44:21 1.25
@@ -34,7 +34,7 @@
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.24 $
+ * @version $Revision: 1.25 $
*/
abstract public class SpySession
implements Runnable, Session, XASession
@@ -260,19 +260,20 @@
closed=true;
}
+ Iterator i;
synchronized (consumers) {
//notify the sleeping synchronous listeners
if ( sessionConsumer != null )
sessionConsumer.close();
- Iterator i=consumers.iterator();
- while (i.hasNext()) {
- SpyMessageConsumer
messageConsumer=(SpyMessageConsumer)i.next();
- messageConsumer.close();
- }
-
+ i=consumers.iterator();
}
+
+ while (i.hasNext()) {
+ SpyMessageConsumer
messageConsumer=(SpyMessageConsumer)i.next();
+ messageConsumer.close();
+ }
connection.sessionClosing(this);
}
@@ -403,7 +404,9 @@
if (closed) throw new IllegalStateException("The session is closed");
synchronized (consumers) {
- consumers.add( who );
+ HashSet newMap=(HashSet)consumers.clone();
+ newMap.add(who);
+ consumers=newMap;
}
connection.addConsumer(who);
@@ -413,11 +416,14 @@
void removeConsumer(SpyMessageConsumer who) throws JMSException
{
- synchronized (connection) {
- connection.removeConsumer( who );
- }
+ connection.removeConsumer( who );
- consumers.remove( who );
+ synchronized (consumers) {
+ HashSet newMap=(HashSet)consumers.clone();
+ newMap.remove(who);
+ consumers=newMap;
+ }
+
}
public TextMessage createTextMessage(String string) throws JMSException