Ah, I see why. One of those clients is always going to get through first and the tryLocks(1) will happen too fast. Meant to have a sleep in there of 1 + random. I'll update it. Cheers, Steve
On Jul 12, 2010, at 3:47 PM, Sebby, Paul D. wrote: > When I run Steve's PlayingWithToolkitMapOfLocks.java sample program with 2 > clients, I find that one client is always successful in obtaining every lock > (i.e. prints "true" for each lock acquisition) and the other client never > gets any of the locks. > > That seems odd; looking at the code, I would expect that one client would get > some locks and the other client would get other locks, depending on which > client happens to get to the code that tries the lock first. So, I would > expect to see a mix of "true" and "false" lines below as the locks accumulate > in the map. > Am I missing something? > > Paul > > Waiting ... > MAP Locked: abf093e8516a4030a8ff4963b7629c22: true > MAP Locked: 830ea7ed33224b34bdb5a99833bc7abd: true > MAP Locked: 7efcd98d4ea44e1a9311c3ab391106f6: true > MAP Locked: 44926696819d4f9787cd9b3e0054b12c: true > MAP Locked: 67b658dcce634d648e37f5162a3682c4: true > MAP Locked: b2cbff012bf646a98e8c55c70bc0b091: true > ... finished 0 > > _______________________________________________ > tc-dev mailing list > tc-dev@lists.terracotta.org > http://lists.terracotta.org/mailman/listinfo/tc-dev
_______________________________________________ tc-dev mailing list tc-dev@lists.terracotta.org http://lists.terracotta.org/mailman/listinfo/tc-dev