question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@Asynchronous doesn't belong in org.eclipse.microprofile.faulttolerance

See original GitHub issue

The notion of an @Asynchronous method is one that’s existed in Java EE since it was introduced in EJB 3.1. It was arguably a mistake at the time to have put this annotation in the javax.ejb package, instead of allowing it to have been used with any CDI bean, but the history was that at the time CDI was a under a cloud of controversy and trying to present as small a target as possible, and was therefore trying not to step on EJB’s toes too much.

So the addition of org.eclipse.microprofile.faulttolerance.Asynchronous which can, as I understand it, be used on any CDI bean is a big improvement from this point of view. Now, if I’m not misunderstanding, we can add asynchronous methods to any CDI bean. Excellent, if true!

However, from what I can tell from a cursory inspection of its documented semantics, @Asynchronous doesn’t have anything much in the way of semantics that are specific to Fault Tolerance. That makes sense: asynchronicity and fault tolerance are relatively orthogonal concerns, though I can see how there are some semantics that need to be well-defined at their intersection.

Nevertheless, asynchronicity isn’t an aspect of Fault Tolerance, and therefore it doesn’t seem to me that @Asynchronous belongs in the org.eclipse.microprofile.faulttolerance package. I’m not sure where it does belong, but … not there.

Hrrrrm, perhaps a better place for it to live would be in org.eclipse.microprofile.concurrent, since it seems much more closely related to the functionality in that package? I’m not sure.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
Emily-Jiangcommented, Feb 22, 2019

Thank you @gavinking for your thoughts! Inventing @Asynchronous was originally triggered to specify a multithreading mode of bulkhead. As per your comments, since there is no such asynchronous api, we have to introduce it first. This annotation is quite useful. I like what you suggested though. Maybe it is better to be moved under concurrency spec. When the concurrency spec is released, we can interlock more to see whether we can make that move.

1reaction
gavinkingcommented, Feb 22, 2019

@Emily-Jiang yep, great. Indeed, I hope the Concurrency spec will define a relationship between @Asynchronous and ManagedExecutors, which would make the connection even clearer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Asynchronous (microProfile-fault-tolerance-api 2.1 API)
Wrap the execution and invoke it asynchronously. The context for RequestScoped must be active during the method invocation, which means the method with...
Read more >
Fallback (microProfile-fault-tolerance-api 2.1 API)
The fallback annotation to define the fallback handler class so that a failure can be handled properly. Below is the criteria: If value...
Read more >
Asynchronous (microProfile-fault-tolerance-api 1.1.2-RC1 API)
Detail: Field |; Element. org.eclipse.microprofile.faulttolerance. Annotation Type Asynchronous ... Wrap the execution and invoke it asynchronously.
Read more >
Microprofile Fault Tolerance
The annotations @Asynchronous , @Bulkhead , @CircuitBreaker , @Fallback , @Retry and @Timeout are all interceptor bindings. These annotations ...
Read more >
org.eclipse.microprofile.faulttolerance - MicroProfile API - Open Liberty
Annotation Type Fallback · If the method returns normally (doesn't throw), the result is simply returned. · Otherwise, if the thrown object is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found