There looks to be a slight concurrency problem in ReplicationQueue in the flush 
method (in HEAD).


  |          cache.callRemoteMethods(null, // send to all live nodes in the 
cluster
  |                                  TreeCache.replicateAllMethod, new 
Object[]{l}, false, true, 5000);
  |          elements.clear();
  | 
  | 

The elements.clear call is not atomic and another thread calling add between 
the callRemoteMethods and the clear would subsequently clear it.

I would suggest you move the clear up in the synchronized block after the clone.


  |    public void flush() {
  |       List l;
  |       synchronized(elements) {
  |          if(log.isInfoEnabled())
  |             log.info("flush(): flushing repl queue (num elements=" + 
elements.size() + ")");
  |          l=(List)elements.clone();
  |          elements.clear();
  |       }
  | 
  |       try {
  |          cache.callRemoteMethods(null, // send to all live nodes in the 
cluster
  |                                  TreeCache.replicateAllMethod, new 
Object[]{l}, false, true, 5000);
  |       }
  |       catch(Throwable t) {
  |          log.error("failed replicating " + l.size() + " elements in 
replication queue", t);
  |       }
  |    }
  | 

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

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


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to