[
https://issues.jboss.org/browse/WFLY-4384?page=com.atlassian.jira.plugin....
]
Eduardo Martins edited comment on WFLY-4384 at 2/28/15 2:16 AM:
----------------------------------------------------------------
The "execution" property is related to the thread invoking/executing the
contextual object, which may not be the thread creating that object. In your example code
the executing thread is a ManagedExecutorService internal thread, which has no
transaction.
You can see an example of its usage at
[
http://docs.oracle.com/javaee/7/api/javax/enterprise/concurrent/ContextSe...]
was (Author: emmartins):
The "execution" property is related to the thread invoking/executing the
contextual object, which may not be the thread creating that object. In your example code
the executing thread is a ManagedExecutorService internal thread, which has no
transaction.
You can see an example of its usage at
http://docs.oracle.com/javaee/7/api/javax/enterprise/concurrent/ContextSe...
ContextService (JSR236): transactional context always suspended
---------------------------------------------------------------
Key: WFLY-4384
URL:
https://issues.jboss.org/browse/WFLY-4384
Project: WildFly
Issue Type: Bug
Components: EE
Affects Versions: 8.2.0.Final, 9.0.0.Alpha1
Reporter: Maxim Frolov
Assignee: Eduardo Martins
Priority: Critical
According to ยง3.3.5 of JSR-236 specification:
??By using an execution property when creating the contextual proxy object, application
components can choose to not suspend the transactional context on the thread ...??
Given the following EJB and Task:
{code:java}
@WebService(serviceName = "Jsr236WebService")
@Stateless
public class Jsr236WebService {
@Inject Jsr236ManagedTask jsr236ManagedTask;
@Resource ManagedExecutorService executor;
@Resource ContextService contextService;
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
Map<String, String> execProps = new HashMap<>();
execProps.put(ManagedTask.TRANSACTION,
ManagedTask.USE_TRANSACTION_OF_EXECUTION_THREAD);
Future<String> future = executor.submit(
contextService.createContextualProxy(jsr236ManagedTask, execProps,
Callable.class));
try {
return future.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
}
{code}
{code:java}
@Dependent
@Transactional(Transactional.TxType.MANDATORY)
public class Jsr236ManagedTask implements Callable<String>, ManagedTask {
@Override
public String call() {
return "called";
}
@Override
public Map<String, String> getExecutionProperties() {
Map<String, String> execProps = new HashMap<>();
execProps.put(ManagedTask.TRANSACTION,
ManagedTask.USE_TRANSACTION_OF_EXECUTION_THREAD);
return execProps;
}
}
{code}
When the {{call()}} Method of the task is called the following exception occurs:
{noformat}
javax.transaction.TransactionalException: ARJUNA016110: Transaction is required for
invocation
{noformat}
See maven test project [
https://github.com/wrungel/bugs/tree/master/jsr236-test] on
GitHub.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)