Class Overview
Locking scheme for Helix that uses the ZooKeeper exclusive lock implementation
Please use the following lock order convention: Cluster, Participant, Resource, Partition
WARNING: this is not a reentrant lock
Summary
Public Methods |
boolean
|
isBlocked()
Check if this object is blocked waiting on the lock
|
synchronized
boolean
|
lock()
Try to synchronously lock the scope
|
synchronized
boolean
|
unlock()
Unlock the scope
|
Protected Methods |
void
|
setBlocked(boolean isBlocked)
Set if this the lock method is currently blocked
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
From interface
org.apache.helix.lock.HelixLock
abstract
boolean
|
isBlocked()
Check if this object is blocked waiting on the lock
|
abstract
boolean
|
lock()
Synchronously acquire a lock
|
abstract
boolean
|
unlock()
Release a lock
|
|
Public Constructors
public
ZKHelixLock
(ClusterId clusterId, Scope<?> scope, ZkClient zkClient)
Initialize for a cluster and scope
Parameters
clusterId
| the cluster under which the lock will live |
scope
| the scope to lock |
zkClient
| an active ZK client
|
Public Methods
public
boolean
isBlocked
()
Check if this object is blocked waiting on the lock
Returns
- true if blocked, false otherwise
public
synchronized
boolean
lock
()
Try to synchronously lock the scope
Returns
- true if the lock succeeded, false if it failed, as is the case if the connection to ZK
is lost
public
synchronized
boolean
unlock
()
Returns
- true if unlock executed, false otherwise
Protected Methods
protected
void
setBlocked
(boolean isBlocked)
Set if this the lock method is currently blocked
Parameters
isBlocked
| true if blocked, false otherwise
|