Asynchronous EJB methods

A straightforward way to invoke asynchronous behavior is to annotate an EJB business method, or the EJB class, with @Asynchronous. Invocations to these methods immediately return, optionally with a Future response type. They are executed in a separate, container-managed thread. This usage works well for simple scenarios but is limited to EJBs:

import javax.ejb.Asynchronous;

@Asynchronous
@Stateless
public class Calculator {

    public void calculatePi(long decimalPlaces) {
        // this may run for a long time
    }
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.198.174