Does @Asynchronous have a Timeout

asynchronous, ejb, jakarta-ee, java, timeout

Solution

Every time a method annotated `@Asynchronous` is invoked by anyone it will immediately return regardless of how long the method actually takes.

Each invocation should return a `Future` object that essentially starts out empty and will later have its value filled in by the container when the related method call actually completes.

For example:

@Asynchronous
public Future<String> cantstopme() {

}

and then call it this way:

final Future<String> request = cantstopme();

And later you could ask for the result using the Future.get() method with a specific timeout, i.e:

request.get(10, TimeUnit.SECONDS);

Problem

When i call a Method like this: ``` @Asynchronous public void cantstopme() { for(;;); } ``` Would it run forever or would the Application Server kill it after a certain time?

Original source