[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
How to get a clustered Condition using toolkit/express mode?  XML
Forum Index -> General
Author Message
shortmem

journeyman

Joined: 12/12/2011 07:59:13
Messages: 17
Offline

Hi, is there any way to get a clustered condition when using express mode?

The following code

Code:
 ReadWriteLock lock = toolkit.getReadWriteLock("TheRWLock");
 
 Lock wl = lock.writeLock();
 
 Condition cond = wl.newCondition();
 


Seems to produce a cluster aware condition (org.terracotta.locking.TerracottaCondition), however there's no way to share it across distinct VMs.
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1491
Offline

Which version of terracotta you are using , in the current version by default it's shared across VM's.

Rakesh Joshi
Senior Consultant
Terracotta.
shortmem

journeyman

Joined: 12/12/2011 07:59:13
Messages: 17
Offline

rajoshi wrote:
Which version of terracotta you are using , in the current version by default it's shared across VM's. 


Rajoshi I tested in both 3.7.2 and 3.7.4. The test is very simple: Just call await in one or more nodes, and launch another an call signalAll(). The previous nodes remain blocked.

The examples I found work only with DSO:

Code:
  protected Condition getCondition(final Lock lock, String name) {
     Assert.assertTrue(Terracotta.isManaged(lock));
     return Terracotta.lookupOrCreateRoot(name, new Callable<Condition>() {
       public Condition call() throws Exception {
         return lock.newCondition();
       }});
   }
 


I think that, if possible, the returned lock from writeLock() should be a Terracotta specialization with a getCondition(String name). Even in the same node newCondition() will return distinct conditions (as is expected).
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.7 © JForum Team