Using tasks also means being able to define when they should be executed. This recipe covers this, as well as getting the returning results whenever they return.
Scheduling asynchronous tasks with returning results
Getting ready
Let's first add our Jakarta EE 8 dependency:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
How to do it...
The following five steps are...