My application works like this:
@Stateless
@LocalBean
public class SomeService {
@EJB
private EntityFacade entityFacade;
@EJB
private SomeManager someManager;
public Response methodA() {
// persist some entityA (this methos uses JPA)
entityFacade.create(entityA).getId();
// asynchronous call
someManager.methodB(entityA);
return response;
}
}
@Stateless
@LocalBean
public class SomeManager {
@Resource
private TimerService timerService;
@Asynchronous
public void methodB(Entity entity) {
//do something
....
//create timer and save handle in entity
TimerHandle handle = timerService.createSingleActionTimer(timerDuration,
new TimerConfig(entity.getId(), true)).getHandle();
alert.setTimerHandle(handle);
}
@Timeout
private void timeout(Timer timer) {
Long id= (Long) timer.getInfo();
Entity entity = alertFacade.find(id);
methodB(entity);
}
}
When I remove the @Asynchronous annotation, the exception occurs right away
after calling methodA(). When I leave it there, the exception occurs after
the first timeout.
Thanks,
Theodor
On Thu, Jul 15, 2010 at 6:34 PM, <glassfish_at_javadesktop.org> wrote:
> Does your application use JPA that is part of the same transaction as the
> create timer call?
>
> -marina
> [Message sent by forum member 'mvatkina']
>
> http://forums.java.net/jive/thread.jspa?messageID=477746
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>