Hello,  I'm trying to execute concurrent add,remove over a Collection for a 
TreeAOPCache with multiple members. I'm finding some problems that leave the Caches at 
inconsistent state.

I've created a version of testConcurrentPut() method fot TreeAOPCache to be executed 
at:

org.jboss.test.cache.test.standAloneAop.ReplicatedTxAopTest

The method adds a new value at the same collection for distinct Cache members. The TX 
commit replication doesn't commit successfully but there aren't any Exception thrown.

The "tester" Cache finish with "languaje" German and the "tester1" cache finish with 
"languaje" English.

Probably I'm missing something important or is this a TreeCacheAOP limitation?. Is 
there a better way of working with collections at TreeCacheAOP?. Thank you.


  | public void testConcurrentPuts() throws Exception
  |       {
  |             Thread t1 = new Thread()
  |              {
  |                     Transaction tx;
  | 
  |                     public void run()
  |                     {
  |                        try {
  |                             tester1.createPerson("/person/test6", "p6", 50);       
                                 
  |                             UserTransaction tx = getTransaction();
  |                              tx.begin();                                           
                 
  |                             tester.addLanguage("/person/test6", "German");         
 
  |                             _pause(4000);
  |                               tx.commit();
  |                        } catch (Exception ex) {
  |                               fail(ex.toString());
  |                        }
  |                     }
  |              };
  | 
  |              Thread t2 = new Thread()
  |              {
  |                     Transaction tx;
  | 
  |                     public void run()
  |                     {
  |                        try {
  |                               _pause(1000); // give Thread1 time to createPerson
  |                             UserTransaction tx = getTransaction();
  |                              tx.begin();
  |                             tester1.addLanguage("/person/test6", "English");
  |                              tx.commit();
  |                        } catch (Exception ex) {
  |                               fail(ex.toString());
  |                        }
  |                     }
  |              };
  | 
  |              t1.start();
  |              t2.start();
  |              
  |              t1.join();
  |              t2.join();
  |              
  |             int size = tester.getLanguagesSize("/person/test6");
  |             assertTrue(size == 1);
  |             for (int i = 0; i < size; i++) {
  |                        System.out.println("tester:" + i + " : " + 
tester.getLanguage("/person/test6", i));
  |                     }
  |             size = tester1.getLanguagesSize("/person/test6");
  |                     assertTrue(size == 1);  
  |             for (int i = 0; i < size; i++) {
  |                        System.out.println("tester1:" + i + " : " + 
tester1.getLanguage("/person/test6", i));
  |                     }       
  |               }
  | 
  | static void _pause(long millis)
  |       {
  |              try {
  |                     Thread.sleep(millis);
  |              } catch (Exception ex) {
  |              }
  |       }
  | 

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

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


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to