|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.sasl.aop.AbstractRootAspect
net.sf.sasl.aop.distributed.lock.DistributedLockAspect
public class DistributedLockAspect
The task that the aspect addresses is to provide a thread shared distributed lock session, if none exists for the current thread and to do static and dynamic distributed locks and unlocks, which have been declared via distributed lock annotations. So the aspect focuses on the following fields:
Field Summary |
---|
Fields inherited from class net.sf.sasl.aop.AbstractRootAspect |
---|
logger |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
DistributedLockAspect()
|
Method Summary | |
---|---|
protected LockInformation |
buildLockInformationFromDynamicLockKey(DistributedDynamicMutexLockKey lockKeyAnnotation,
DistributedDynamicMutexLockKeys parentAnnotation,
Method targetMethod,
Object[] targetArguments,
int curParameterIndex)
Maps a DistributedMutexLockKey annotation to a lock information. |
protected LockInformation |
buildLockInformationFromStaticLockKey(DistributedStaticMutexLock lockAnnotation,
DistributedStaticMutexLocks parentAnnotation)
Maps a DistributedStaticMutexLock annotation to a lock information. |
protected void |
buildLockInformationList(List<LockInformation> lockInformationList,
Annotation[] annotations,
Method targetMethod,
Object[] targetArguments,
int curParameterIndex)
Maps an array of annotations (from the method or a parameter) to lock informations and adds the mapped lock informations to the passed lock information list. |
protected List<LockInformation> |
buildUnsortedLockInformationList(org.aopalliance.intercept.MethodInvocation invocation)
Builds an unsorted list of lock informations from the lock annotations which are present at the method and parameters of the method. |
protected void |
doAnnotationDeclaredLocks(ILockSession session,
org.aopalliance.intercept.MethodInvocation invocation)
Will do all locks, which are declared via annotations at the target method, in the current lock sequence of the passed lock session. |
ILockSessionFactory |
getLockSessionFactory()
|
ReflectionHelper |
getReflectionHelper()
|
SpringProxyHelper |
getSpringProxyHelper()
|
Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
Please see the header documentation of the class what this method does. |
void |
setLockSessionFactory(ILockSessionFactory lockSessionFactory)
Sets a lock session factory from which lock sessions will be created or fetched. |
void |
setReflectionHelper(ReflectionHelper reflectionHelper)
Sets a reflection helper which will be used for reflection operations. |
void |
setSpringProxyHelper(SpringProxyHelper springProxyHelper)
Sets the spring proxy helper which will be used for spring proxy reflection operations. |
Methods inherited from class net.sf.sasl.aop.AbstractRootAspect |
---|
getLogger, getOrder, setLogger, setLoggerByName, setOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DistributedLockAspect() throws ReflectionException
ReflectionException
Method Detail |
---|
public ILockSessionFactory getLockSessionFactory()
setLockSessionFactory(ILockSessionFactory)
public void setLockSessionFactory(ILockSessionFactory lockSessionFactory) throws IllegalArgumentException
lockSessionFactory
-
IllegalArgumentException
public SpringProxyHelper getSpringProxyHelper()
setSpringProxyHelper(SpringProxyHelper)
public void setSpringProxyHelper(SpringProxyHelper springProxyHelper)
springProxyHelper
- non null.public ReflectionHelper getReflectionHelper()
setReflectionHelper(ReflectionHelper)
public void setReflectionHelper(ReflectionHelper reflectionHelper)
reflectionHelper
- non null.public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
invoke
in interface org.aopalliance.intercept.MethodInterceptor
Throwable
MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)
protected void doAnnotationDeclaredLocks(ILockSession session, org.aopalliance.intercept.MethodInvocation invocation) throws DeadlockException, LockOperationException, InterruptedException, ReflectionException, IllegalAnnotationAttributeValueException
session
- non null.invocation
- non null.
DeadlockException
- if a deadlock constellation occurred during trying to lock a mutex.
LockOperationException
- if the lock session forbids to execute an operation,
for example a mutex should be locked in the current lock sequence but
is already acquired (not locked) by another sequence.
InterruptedException
- if a tryLock was done which exceeded the maximum wait time.
ReflectionException
- if a reflection operation failed, for example because a field/method is not present.
IllegalAnnotationAttributeValueException
protected List<LockInformation> buildUnsortedLockInformationList(org.aopalliance.intercept.MethodInvocation invocation) throws ReflectionException, IllegalAnnotationAttributeValueException
invocation
- non null.
ReflectionException
- if a reflection operation failed, for example because a field/method is not present.
IllegalAnnotationAttributeValueException
protected void buildLockInformationList(List<LockInformation> lockInformationList, Annotation[] annotations, Method targetMethod, Object[] targetArguments, int curParameterIndex) throws ReflectionException, IllegalAnnotationAttributeValueException
lockInformationList
- non null.annotations
- non null.targetMethod
- null or non null, depending if dynamic locks should be processed or not.targetArguments
- null or non null, depending if dynamic locks should be processed or not.curParameterIndex
- lesser than zero if no annotations of a parameter should get processed, the current parameter index else.
ReflectionException
- if a reflection operation failed.
IllegalAnnotationAttributeValueException
protected LockInformation buildLockInformationFromStaticLockKey(DistributedStaticMutexLock lockAnnotation, DistributedStaticMutexLocks parentAnnotation)
lockAnnotation
- non null.parentAnnotation
- null or non null.
protected LockInformation buildLockInformationFromDynamicLockKey(DistributedDynamicMutexLockKey lockKeyAnnotation, DistributedDynamicMutexLockKeys parentAnnotation, Method targetMethod, Object[] targetArguments, int curParameterIndex) throws ReflectionException, IllegalAnnotationAttributeValueException
lockKeyAnnotation
- non null.parentAnnotation
- null or non null.targetMethod
- non null.targetArguments
- non null.curParameterIndex
- lesser than zero if no annotation of a parameter should get processed, the current parameter index else.
ReflectionException
IllegalAnnotationAttributeValueException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |