[concurrency-interest] Synchronization/locking in a clustered, JEE environment

Bela Ban belaban at yahoo.com
Fri Feb 9 13:07:03 EST 2007

Question: in the code below, will we acquire 1000 cluster-wide locks ?

Lock lock=new ReentrantLock(); // make it distributed

for(int i=0; i < 1000; i++) {
  lock.lock(); // acquires a distributed lock across the cluster
  try {
    // do something
  finally {

Tim Eck wrote:
> Ryan LeCompte wrote:
>  > ...How would one ensure that a "global lock" is acquired if I have a
>  > method on the stateless session bean
> You might want to check out Terracotta (www.terracotta.org) for
> something like this. In terracotta, an object's monitor (ie. java
> synchronization) can be used in a distributed fashion. For instance,
> you can take a standard instance of j.u.c.l.ReentrantLock, declare it to
> be distributed, and then use it use across multiple VMs. Of course,
> you can also regular synchronization and wait/notify with Terracotta
> too (and many other things). Feel free to contact me directly or start
> up a thread on of our mailing lists for more info
> -tim
> Disclaimer: I am employee of Terracotta.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest

Bela Ban
Lead JGroups / JBoss Clustering team
JBoss - a division of Red Hat

More information about the Concurrency-interest mailing list