users@glassfish.java.net

Re: how to start ejb3 timer?

From: <glassfish_at_javadesktop.org>
Date: Wed, 04 Mar 2009 15:33:46 PST

There isn't a better way in Java EE 5 but we're planning to fix this in Java EE 6. EJB 3.1 will
add a way to have the container automatically create an EJB timer as a result of deployment. If
you're so inclined you can try it out on the V3 branch. Your EJB code would just look like this :

// Automatically create a timer that expires every five minutes
// within the hour and calls this method
@Schedule(minute="*/5", hour="*")
public void timeout() {

   ...

}

The EJB 3.1 Public draft has the full details in the timer chapter ( ) .
http://jcp.org/aboutJava/communityprocess/pr/jsr318/index.html
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=335175