[jboss-user] [JBoss Cache Users] - Re: Cache locking problem

mlohbihler do-not-reply at jboss.com
Thu Oct 15 21:21:20 EDT 2009


Ok, i've tried a number of different things now including using the configuration from Manik's demo, but nothing fixes the problem. The only thing i haven't tried is wrapping my put into a transaction, but since i can't find any code or documentation that suggests this is necessary, i'm saving it for my glorious last effort.

I've simplified the code that i can using to test. As before, using debugging it's easy to see that data versioning exceptions are not being thrown as they should. When i just let it run, the counter only gets incremented to around 2000, when it should reach exactly 3000.

    public static void main(String[] args) throws Exception {
  |         Cache<String, Integer> cache = new DefaultCacheFactory<String, Integer>().createCache("conf/cache.xml");
  |         Node<String, Integer> root = cache.getRoot();
  |         
  |         // Wait for other members.
  |         System.out.println("Waiting for other members...");
  |         while (cache.getMembers().size() < 3)
  |             Thread.sleep(50);
  |         
  |         System.out.println("Running...");
  |         
  |         int versioningFaults = 0;
  |         for (int i=0; i<1000; i++) {
  |             // Modify the cache
  |             while (true) {
  |                 try {
  |                     Integer count = root.get("key");
  |                     if (count == null)
  |                         count = 0;
  |                     count++;
  |                     while (true) {
  |                         try {
  |                             root.put("key", count);
  |                             break;
  |                         }
  |                         catch (SuspectException e) {}
  |                         catch (TimeoutException e) {}
  |                     }
  |                     break;
  |                 }
  |                 catch (DataVersioningException e) {
  |                     versioningFaults++;
  |                 }
  |             }
  |         }
  |         
  |         System.out.println("Final count: "+ root.get("key") +", faults: "+ versioningFaults);
  |         
  |         cache.stop();
  |         cache.destroy();
  |     }
  | 

As before, any help, hints, and at this point even flames, etc are greatly appreciated. 

Regards,
m@


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

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



More information about the jboss-user mailing list