net.sf.sasl.aop.distributed.lock
Class LockInformation

java.lang.Object
  extended by net.sf.sasl.aop.distributed.lock.LockInformation
All Implemented Interfaces:
Comparable<LockInformation>

public class LockInformation
extends Object
implements Comparable<LockInformation>

Since:
0.0.1 (sasl-aop-distributed-library)
Author:
Philipp Förmer

Constructor Summary
LockInformation()
           
 
Method Summary
 int compareTo(LockInformation other)
          Compares two LockInformations with each other.
 boolean equals(Object obj)
          Two LockInformations are equal, if all data the instance variables point to is equal.
 String getLockKey()
           
 int getLockOrderNumber()
           
 long getMaxLockWaitTime()
           
 int hashCode()
           
 void setLockKey(String lockKey)
          Sets the key (=mutex) that should get locked.
 void setLockOrderNumber(int orderNumber)
          Sets the priority value of the lock.
 void setMaxLockWaitTime(long maxLockWaitTime)
          Sets the maximum number of milliseconds to wait before the lock for the lock key is granted.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockInformation

public LockInformation()
Method Detail

getLockKey

public String getLockKey()
Returns:
null or non null.
Since:
0.0.1 (sasl-aop-distributed-library)
See Also:
setLockKey(String)

setLockKey

public void setLockKey(String lockKey)
Sets the key (=mutex) that should get locked.

Parameters:
lockKey - null or non null.
Since:
0.0.1 (sasl-aop-distributed-library)

getLockOrderNumber

public int getLockOrderNumber()
Returns:
any integer value.
Since:
0.0.1 (sasl-aop-distributed-library)
See Also:
setLockOrderNumber(int)

setLockOrderNumber

public void setLockOrderNumber(int orderNumber)
Sets the priority value of the lock. Lower values mean a higher priority. The order number is needed to order the locking behaviour, if multiple locks should be done at the same point of time.

Parameters:
orderNumber - any integer value.
Since:
0.0.1 (sasl-aop-distributed-library)

getMaxLockWaitTime

public long getMaxLockWaitTime()
Returns:
a value greater or equal to zero.
Since:
0.0.1 (sasl-aop-distributed-library)
See Also:
#setMaxLockWaitTime(int)

setMaxLockWaitTime

public void setMaxLockWaitTime(long maxLockWaitTime)
                        throws IllegalArgumentException
Sets the maximum number of milliseconds to wait before the lock for the lock key is granted. A zero value means to wait for infinite time.

Parameters:
maxLockWaitTime - a value greater or equal to zero.
Throws:
IllegalArgumentException - if parameter maxLockWaitTime is lesser than zero.
Since:
0.0.1 (sasl-aop-distributed-library)

compareTo

public int compareTo(LockInformation other)
Compares two LockInformations with each other. The return value is:

Specified by:
compareTo in interface Comparable<LockInformation>
Returns:
-1, 0 or 1.
Since:
0.0.1 (sasl-aop-distributed-library)
See Also:
Comparable.compareTo(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Two LockInformations are equal, if all data the instance variables point to is equal.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)


Copyright © 2010. All Rights Reserved.