public static void applyConcurrencyAttributes(BeanContext beanContext, List<MethodConcurrencyInfo> methodConcurrencyInfos) throws OpenEJBException {
if (beanContext.isBeanManagedConcurrency()) return;
Logger log = Logger.getInstance(LogCategory.OPENEJB_STARTUP.createChild("attributes"), MethodConcurrencyBuilder.class);
List<MethodConcurrencyInfo> lockInfos = new ArrayList<MethodConcurrencyInfo>();
List<MethodConcurrencyInfo> accessTimeoutInfos = new ArrayList<MethodConcurrencyInfo>();
MethodConcurrencyBuilder.normalize(methodConcurrencyInfos, lockInfos, accessTimeoutInfos);
Map<Method, MethodAttributeInfo> attributes;
// handle @Lock
attributes = MethodInfoUtil.resolveAttributes(lockInfos, beanContext);
if (log.isDebugEnabled()) {
for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
Method method = entry.getKey();
MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
log.debug("Lock: " + method + " -- " + MethodInfoUtil.toString(value.methods.get(0)) +
" " + value.concurrencyAttribute);
}
}
for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
String s = value.concurrencyAttribute.toUpperCase();
methodContext.setLockType(LockType.valueOf(s));
}
// handle @AccessTimeout
attributes = MethodInfoUtil.resolveAttributes(accessTimeoutInfos, beanContext);
if (log.isDebugEnabled()) {
for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
Method method = entry.getKey();
MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
log.debug("AccessTimeout: " + method + " -- " + MethodInfoUtil.toString(value.methods.get(0)) + " " +
" " + value.accessTimeout.time + " " + value.accessTimeout.unit);
}
}
for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {