me.prettyprint.cassandra.locking
Class HLockImpl

java.lang.Object
  extended by me.prettyprint.cassandra.locking.HLockImpl
All Implemented Interfaces:
HLock

public class HLockImpl
extends Object
implements HLock

Default Lock implementation of HLock

Author:
patricioe (Patricio Echague - patricioe@gmail.com), tnine (Todd Nine)

Constructor Summary
HLockImpl(String lockPath, String lockId)
           
 
Method Summary
 boolean equals(Object obj)
           
 Future<Void> getHeartbeat()
           
 String getLockId()
           
 HLockObserver getObserver()
          Get the observer for this lock
 String getPath()
           
 int hashCode()
           
 boolean isAcquired()
           
 void setAcquired(boolean acquired)
           
 void setHeartbeat(Future<Void> heartbeat)
           
 void setLockId(String lockId)
          Sets the lock id (UID) that identifies uniquely this lock object
 void setObserver(HLockObserver observer)
          Set the observer to receive events
 void setPath(String lockPath)
          Sets the lock path for this lock.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HLockImpl

public HLockImpl(String lockPath,
                 String lockId)
Method Detail

getPath

public String getPath()
Specified by:
getPath in interface HLock
Returns:
the lock path shared among all client that refer to this lock. I.e: /Users/patricioe

setPath

public void setPath(String lockPath)
Description copied from interface: HLock
Sets the lock path for this lock.

Specified by:
setPath in interface HLock
Parameters:
lockPath - the lock path i.e.: /Users/patricioe or "aLockPathAllClientsWillAgreeOn"

getLockId

public String getLockId()
Specified by:
getLockId in interface HLock
Returns:
the lock id assigned to this lock after this lock is placed

setLockId

public void setLockId(String lockId)
Description copied from interface: HLock
Sets the lock id (UID) that identifies uniquely this lock object

Specified by:
setLockId in interface HLock
Parameters:
lockId - unique lock id that identifies uniquely a client. This is for internal usage only. Users don't and should not call this setter.

isAcquired

public boolean isAcquired()
Specified by:
isAcquired in interface HLock
Returns:
whether this lock as been successfully acquired or not

setAcquired

public void setAcquired(boolean acquired)

setObserver

public void setObserver(HLockObserver observer)
Description copied from interface: HLock
Set the observer to receive events

Specified by:
setObserver in interface HLock

getObserver

public HLockObserver getObserver()
Description copied from interface: HLock
Get the observer for this lock

Specified by:
getObserver in interface HLock
Returns:
the observer

getHeartbeat

public Future<Void> getHeartbeat()
Returns:
the heartbeat

setHeartbeat

public void setHeartbeat(Future<Void> heartbeat)
Parameters:
heartbeat - the heartbeat to set

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.