Registering a callback in the future
I can write a method like this in EJB that will execute asynchronously:
import java.util.concurrent.Future;
import javax.ejb.AsyncResult;
import javax.ejb.Asynchronous;
...
@Asynchronous
public Future<String> foo(String s) {
...
return new AsyncResult<String>("bar");
}
Is there a way to register a callback (like a lambda) that will be called as soon as this is complete? I don't want to block any threads when calling Future#get()
.
+3
source to share
No one has answered this question yet
Check out similar questions: