users@glassfish.java.net

Re: How to enable EJB Timer on GlassFish Cluster?

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Tue, 04 May 2010 12:23:40 -0700

Is the new pool enabled in the cluster?

thanks,
-marina

glassfish_at_javadesktop.org wrote:
> My EJB timer code:
> ********************************************
> import java.util.Date;
> import javax.annotation.Resource;
> import javax.ejb.SessionContext;
> import javax.ejb.Stateless;
> import javax.ejb.Timeout;
> import javax.ejb.Timer;
> import javax.ejb.TimerService;
>
> @Stateless
> public class TimerBean implements TimerLocal {
>
> @Resource SessionContext context;
>
> public void setupTimer() {
> Date timerStart = new Date();
> TimerService timerService = context.getTimerService();
> timerService.createTimer(0, 500, timerStart); // every 5 seconds
> }
>
> @Timeout
> public void timerAction(Timer timer) {
> System.out.println("Time: " + (new Date()));
> }
> }
> ************************************
> Glassfish Console->Configuration->EJB Container->EJB Timer Service->Timer Datasource
>
> The code works properly if "Timer Datasource" is set as default.
>
> The code doesn't work and gives "EJB Timer Service not available" if "Timer Datasource" is changed to the data source for the external ejbTimerPool.
>
> Yet I can ping the ejbTimerPool successfully!
> Could you tell what could went wrong?
> [Message sent by forum member 'raejean99']
>
> http://forums.java.net/jive/thread.jspa?messageID=400334
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>