net.sf.sasl.aop.distributed.lock.annotation.mutex
Annotation Type DistributedDynamicMutexLockKey


@Documented
@Retention(value=RUNTIME)
@Target(value={METHOD,PARAMETER})
public @interface DistributedDynamicMutexLockKey

Annotation to declare a dynamic resolved lock key by a input parameter. For example to protect against concurrent modifications of a customer which may cause inconsistency, the customer id could be used as a potential lock key.

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

Optional Element Summary
 String lockKeySelectorPath
          Defines a path to a class attribute or a getter method thats value should be used as the lock key.
 DistributedDynamicMutexLockKey.LockKeySelectorType lockKeySelectorType
          Defines how the lock key selector path should be interpreted.
 int lockOrderNumber
          If multiple locks should be done, than the lock order number (=lock priority) defines in which order the locks should be done.
 long maxLockWaitTime
          The maximum amount of milliseconds to wait for get the mutex locked.
 int parameterIndex
          If the annotation is used at method level, than this declares the parameter index to which it belongs.
 String postfix
          A postfix string that should get appended to the end of the mutex lock key.
 String prefix
          A prefix string that should get pushed before the mutex lock key.
 

lockKeySelectorType

public abstract DistributedDynamicMutexLockKey.LockKeySelectorType lockKeySelectorType
Defines how the lock key selector path should be interpreted. A path could be used, to use nested objects of a parameter as a lock key. The default value is LockKeySelectorType.NONE which means that the toString() method should be invoked on the parameter direct, to get the key to lock.

Default:
net.sf.sasl.aop.distributed.lock.annotation.mutex.DistributedDynamicMutexLockKey.LockKeySelectorType.NONE

lockKeySelectorPath

public abstract String lockKeySelectorPath
Defines a path to a class attribute or a getter method thats value should be used as the lock key. For example if the parameter is of type "CustomerDTO" than the path "customer.customerId", will select the customer id as the lock key, if the path qualifier type is set to LockKeySelectorType.ATTRIBUTE. The default value is "".

Default:
""

parameterIndex

public abstract int parameterIndex
If the annotation is used at method level, than this declares the parameter index to which it belongs. Should be otherwise ignored.

Default:
-1

prefix

public abstract String prefix
A prefix string that should get pushed before the mutex lock key. For example "customer-id-lock-". The default value is "".

Default:
""

postfix

public abstract String postfix
A postfix string that should get appended to the end of the mutex lock key. For example "-customer-id-lock". The default value is "".

Default:
""

maxLockWaitTime

public abstract long maxLockWaitTime
The maximum amount of milliseconds to wait for get the mutex locked. Values lesser or equal to zero mean eternal wait time. The default value is zero.

Since:
0.0.1 (sasl-aop-distributed-lock)
Default:
0L

lockOrderNumber

public abstract int lockOrderNumber
If multiple locks should be done, than the lock order number (=lock priority) defines in which order the locks should be done. Lower values mean lock first. If there are multiple annotations with the same order number, than the lock order for these is arbitrary. The default value is Integer.MAX_VALUE. A lock order should be always declared, as it reduces deadlock problems.

Since:
0.0.1 (sasl-aop-distributed-lock)
Default:
2147483647


Copyright © 2010. All Rights Reserved.