users@glassfish.java.net

Re: EJB Timerservice

From: Theodor Richard <theodor.richard_at_googlemail.com>
Date: Thu, 12 Aug 2010 18:50:05 +0200

Hello Marina,

persisting a TimerHandle is IMHO already a very simple test case ! Here's a
sample code to reproduce the problem:

@Singleton
@LocalBean
@Startup
public class DummySessionBean {

    @Resource
    private TimerService timerService;

    @PersistenceContext
    EntityManager em;

    @PostConstruct
    private void onStartup() {
        long timerDuration = 1000;
        NewEntity entity = new NewEntity();
        TimerHandle handle =
timerService.createSingleActionTimer(timerDuration, new TimerConfig("info",
true)).getHandle();
        entity.setTimerHandle(handle);
        em.persist(entity);
    }

    @Timeout
    public void timeout(Timer timer) {
        Logger.getLogger(getClass().getName()).logp(Level.WARNING,
getClass().getName(), "timeout(..)",
                        "Hello" + timer.getInfo());
    }
}

@Entity
public class NewEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    private TimerHandle timerHandle;

   // getters and setters...
}

I will attach the ear to the bug.

Regards,
Theodor



On Thu, Aug 12, 2010 at 12:02 AM, <glassfish_at_javadesktop.org> wrote:

> Theodor,
>
> If you can't reproduce the problem with a simple test case, how can we find
> out what's wrong? Our v2 regression tests and the new ones that have
> createSingleActionTimer calls all pass.
>
> thanks,
> -marina
> [Message sent by forum member 'mvatkina']
>
> http://forums.java.net/jive/thread.jspa?messageID=479924
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>