com.atlassian.confluence.cluster.hazelcast
Class HazelcastClusteredLock

java.lang.Object
  extended by com.atlassian.confluence.cluster.hazelcast.HazelcastClusteredLock
All Implemented Interfaces:
ClusteredLock, Lock

public class HazelcastClusteredLock
extends java.lang.Object
implements ClusteredLock


Constructor Summary
HazelcastClusteredLock(com.hazelcast.core.IMap<java.lang.String,java.io.Serializable> cache, java.lang.String key)
           
 
Method Summary
 java.io.Serializable getValue()
           
 void lock()
          Acquire a lock - blocks until lock is successfully acquired
 void setValue(java.io.Serializable value)
          Set the value of the key that is locked
 boolean tryLock()
          Try to obtain a lock - returns immediately
 void unlock()
          Unlock this lock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HazelcastClusteredLock

public HazelcastClusteredLock(com.hazelcast.core.IMap<java.lang.String,java.io.Serializable> cache,
                              java.lang.String key)
Method Detail

tryLock

public boolean tryLock()
Description copied from interface: Lock
Try to obtain a lock - returns immediately

Specified by:
tryLock in interface Lock
Returns:
true if the lock was successful, false if currently locked by something else

unlock

public void unlock()
Description copied from interface: Lock
Unlock this lock

Specified by:
unlock in interface Lock

lock

public void lock()
Description copied from interface: Lock
Acquire a lock - blocks until lock is successfully acquired

Specified by:
lock in interface Lock

getValue

public java.io.Serializable getValue()
Specified by:
getValue in interface ClusteredLock
Returns:
The value of the key that is locked

setValue

public void setValue(java.io.Serializable value)
Description copied from interface: ClusteredLock
Set the value of the key that is locked

Specified by:
setValue in interface ClusteredLock


Copyright © 2003-2014 Atlassian. All Rights Reserved.