JavaEJB3.0和未来的方法
我们正在使用EJB3.0,我刚刚读到,未来的方法只能从3.1开始工作。有没有办法在3.0中实现未来的方法?我们使用JBoss6.4.9作为服务器应用程序
我创建了以下方法,我在另一个方法的开头调用它,最后需要这个方法的响应
@Asynchronous
private Future<COPCustomerDTO> getCustomerFromHostSystem(ServerEncryptedString aAccountNumber) {
try {
COPCustomerDTO copCustomerDTO = customerAccountFacade.getCustomerDTOByAdministrativeAccountNumber(aAccountNumber);
return new AsyncResult<>(copCustomerDTO);
} catch (CoPCommunicationException | InvalidExternalAccountReferenceException e) {
throw new LogicRuntimeException("Unable to get COPCustomerDTO for customer", e);
}
}
谢谢
# 1 楼答案
好消息:-)JBoss6.4。x支持@Asynchronous
但是你的代码只能在私有方法上@Asynchronous运行。 这只适用于公共方法,因为JBoss必须创建代理