tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luis Fernando Planella Gonzalez <lfpg....@gmail.com>
Subject @Asynchronous not working for me
Date Mon, 18 Jan 2010 12:43:10 GMT
Hi.
I'm trying to create an asynchronous method invocation using the @Asynchronous annotation.
However, I'm always having the execution in the same thread as the caller bean.
What could be wrong here? I've tried to put the @Asynchronous in all combinations: interface
only, impl only, both, and no luck.

Here's the code:

*** Client code:
@Stateless
public class ReportExecutionServiceBean extends BaseServiceBean implements ReportExecutionServiceLocal
{
    @EJB
    private AsyncReportExecutor reportExecutor;

    public ReportVO runReport(ReportExecutionParameters reportParameters) {
        reportId = ... //... code omitted
        reportExecutor.executeReport(reportId, reportParameters);
        return ... ; // code omitted
    }
}

*** Async bean interface:
public interface AsyncReportExecutor {
    @Asynchronous
    Future<Report> executeReport(Long reportId, ReportExecutionParameters reportParameters);
}

*** Async bean implementation
@Stateless
public class AsyncReportExecutorBean extends BaseServiceBean implements AsyncReportExecutor
{
    @Asynchronous
    public Future<Report> executeReport(Long reportId, ReportExecutionParameters reportParameters)
{
	// ... code omitted
        return new AsyncResult<Report>(report);
    }
}


--
Luis Fernando Planella Gonzalez

Mime
View raw message