[jboss-jira] [JBoss JIRA] (WFLY-12982) MP fault tolerance: CDI contexts not available in @Timeout methods

Miroslav Novak (Jira) issues at jboss.org
Thu Jan 16 08:01:06 EST 2020


Miroslav Novak created WFLY-12982:
-------------------------------------

             Summary: MP fault tolerance: CDI contexts not available in @Timeout methods
                 Key: WFLY-12982
                 URL: https://issues.redhat.com/browse/WFLY-12982
             Project: WildFly
          Issue Type: Bug
          Components: MP Fault Tolerance
    Affects Versions: 19.0.0.Beta1
            Reporter: Miroslav Novak
            Assignee: Radoslav Husar


Say I have a {{@Timeout}} method in my application, which uses a {{@RequestScoped}} service:

{code:java}
@Inject
private MyService service;

@Timeout
public String doSomething() throws InterruptedException {
    return "Hello " + service.call();
}
{code}

The method isn't {{@Asynchronous}}, so it's supposed to be executed on the caller thread and hence the CDI contexts should be available. However, they are not:

{code}
2018-04-03 21:16:35,976 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /: org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.RequestScoped
{code}

Clearly the {{@Timeout}} methods are always executed on a separate thread (see {{HystrixCommandInterceptor.initSetter}}):

{code:java}
// Async and timeout operations use THREAD isolation strategy
if (operation.isAsync() || operation.hasTimeout()) {
    propertiesSetter.withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD);
} else {
    propertiesSetter.withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE);
}
{code}



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list