Skip to content

Commit

Permalink
Merge pull request #5836 from emmartins/WFLY-2698
Browse files Browse the repository at this point in the history
WFLY-2698: allow cmt beans tasks to access user tx
  • Loading branch information
n1hility committed Jan 31, 2014
2 parents fef58e9 + 981a4ee commit f82385b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -134,7 +134,7 @@ protected void realCheckPermission(MethodType methodType, InvocationType invocat
throwException(methodType, invocationType);
}
}
if (!beanManagedTransaction && methodType == MethodType.GET_USER_TRANSACTION) {
if (invocationType != InvocationType.CONCURRENT_CONTEXT && !beanManagedTransaction && methodType == MethodType.GET_USER_TRANSACTION) {
throw EjbMessages.MESSAGES.unauthorizedAccessToUserTransaction();
}
}
Expand Down
Expand Up @@ -21,6 +21,7 @@
*/
package org.jboss.as.ejb3.component.concurrent;

import org.jboss.as.ee.component.interceptors.InvocationType;
import org.jboss.as.ee.concurrent.handle.ContextHandle;
import org.jboss.as.ee.concurrent.handle.ContextHandleFactory;
import org.jboss.as.ejb3.context.CurrentInvocationContext;
Expand Down Expand Up @@ -75,7 +76,14 @@ private static class EJBContextHandle implements ContextHandle {
private final transient InterceptorContext interceptorContext;

private EJBContextHandle() {
interceptorContext = CurrentInvocationContext.get();
final InterceptorContext interceptorContext = CurrentInvocationContext.get();
if(interceptorContext != null) {
this.interceptorContext = interceptorContext.clone();
// overwrite invocation type so EE concurrency tasks have special access to resources such as the user tx
this.interceptorContext.putPrivateData(InvocationType.class, InvocationType.CONCURRENT_CONTEXT);
} else {
this.interceptorContext = null;
}
}

@Override
Expand Down

0 comments on commit f82385b

Please sign in to comment.