]
Ladislav Thon commented on WFLY-12982:
--------------------------------------
Indeed the new implementation should address this.
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
Priority: Major
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}