LockType lockType = sessionBean.getLockType(declaringClass);
if (lockType == null)
{
lockType = LockType.WRITE;
}
Lock lock = new LockImpl(lockType);
return annotationClass.cast(lock);
}
// the method was invoked on the bean class (and not on super class of bean).
// So return null. Later resolveClassAnnotation will pick up the correct bean level
// lock semantics (either via the annotation or via metadata)
return null;
}
// get the concurrency method metadata for this named method
ConcurrentMethodMetaData concurrentMethodMetaData = concurrentMethods.find(namedMethod);
LockType lockType = null;
// if this named method did not have concurrency metadata or lock metadata, then
// check for the method named "*" and see if that has the lock type set
if (concurrentMethodMetaData == null || concurrentMethodMetaData.getLockType() == null)
{
// get lock type for method "*"
lockType = getLockTypeApplicableForAllMethods(sessionBean);
}
else
{
lockType = concurrentMethodMetaData.getLockType();
}
// lock type was not specified for this method nor for the
// method "*"
if (lockType == null)
{
// EJB3.1 spec, section 4.8.5.5 specifies special meaning for @Lock annotation
// on superclass(es) of bean.
// If the method invoked belongs to the superclass of the bean, then pick up
// the @Lock annotation from the superclass. If it's absent on the superclass
// then by default it's LockType.WRITE
String declaringClass = method.getDeclaringClass();
// the check here for @Singleton bean is for optimization, so as to avoid
// doing additional checks for non @Singleton beans since only @Singleton beans have explicit @Lock
if (sessionBean.isSingleton() && declaringClass != null && !sessionBean.getEjbClass().equals(declaringClass))
{
lockType = sessionBean.getLockType(declaringClass);
if (lockType == null)
{
lockType = LockType.WRITE;
}
Lock lock = new LockImpl(lockType);
return annotationClass.cast(lock);
}
// the method was invoked on the bean class (and not on super class of bean).
// So return null. Later resolveClassAnnotation will pick up the correct bean level
// lock semantics (either via the annotation or via metadata)
return null;
}
Lock lock = new LockImpl(lockType);
return annotationClass.cast(lock);
}