[jboss-user] [Clustering/JBoss] - Re: ConcurrentModificationException during session serializa

nbelaevski do-not-reply at jboss.com
Wed Jun 24 12:22:14 EDT 2009


"smarlow at redhat.com" wrote : What I mean, is should SessionBasedClusteredSession.writeExternal + SessionBasedClusteredSession.readExternal instead synchronize on getSession(), which should be the same StandardSessionFacade as RichFaces is synchronizing on.
  | 
  | I haven't recreated the bug yet.  I could either recreate it or you could try the following SessionBasedClusteredSession change (two line change to synchronize on common session facade) :
  | 
  |    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
  |   |    {
  |   |       synchronized (getSession())  // change 1 of 2
  |   |       {
  |   |          // Let superclass read in everything but the attribute map
  |   |          super.readExternal(in);
  |   |       
  |   |          attributes = (Map) in.readObject();      
  |   |       }
  |   |    }
  |   | 
  |   |    public void writeExternal(ObjectOutput out) throws IOException
  |   |    {
  |   |       synchronized (getSession)  // change 2 of 2
  |   |       {
  |   |          // Let superclass write out everything but the attribute map
  |   |          super.writeExternal(out);
  |   |          
  |   |          // Don't replicate any excluded attributes
  |   |          Map excluded = removeExcludedAttributes(attributes);
  |   |         
  |   |          out.writeObject(attributes);
  |   |         
  |   |          // Restore any excluded attributes
  |   |          if (excluded != null)
  |   |             attributes.putAll(excluded);
  |   |       }   
  |   |    
  |   |    }
  |   | 
  | 
Yes, if synchronization will occur on StandardSessionFacade visible to the application/framework developers, than it should work ok. I haven't built JBoss AS before, so not sure whether I'll be able to make these changes and test; in any case, I'll try that and report.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239820#4239820

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239820



More information about the jboss-user mailing list