pero 2005/09/14 05:46:56 Modified: modules/cluster/src/share/org/apache/catalina/cluster/session DeltaSession.java Log: Fix mutli threading issue at session write attributes S. Bug: 36541 Revision Changes Path 1.36 +12 -6 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java Index: DeltaSession.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- DeltaSession.java 26 Jun 2005 21:21:49 -0000 1.35 +++ DeltaSession.java 14 Sep 2005 12:46:56 -0000 1.36 @@ -1003,9 +1003,10 @@ .getString("standardSession.getAttributeNames.ise")); synchronized (attributes) { - return (new Enumerator(attributes.keySet(), true)); + // create a copy from orginal attribute keySet, otherwise internal HaspMap datastructure + // can be inconsistence by other threads. + return (new Enumerator(new ArrayList(attributes.keySet()), true)); } - } /** @@ -1253,8 +1254,10 @@ } // Replace or add this attribute - Object unbound = attributes.put(name, value); - + Object unbound = null ; + synchronized (attributes) { + unbound = attributes.put(name, value); + } // Call the valueUnbound() method if necessary if ((unbound != null) && notify && (unbound instanceof HttpSessionBindingListener)) { @@ -1577,7 +1580,10 @@ boolean addDeltaRequest) { // Remove this attribute from our collection - Object value = attributes.remove(name); + Object value = null; + synchronized (attributes) { + value = attributes.remove(name); + } if (value == null) return;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]