Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cancel or remove Persistent EJBTimers

When we use persistent EJBTimer with @schedule and persistent=true, deploy it to cluster and then we change the actual schedule within @Schedule and re-deploy to the cluster, does the original schedule get replaced with the new one ( removed and added with new parameters ), or both the schedules remain active ( keeping in mind the persistent=true is set )

This is what I have read so far - Each scheduler instance has a unique jndi name and @schedule automatically creates a timer through application deployment so it would be better to remove the automatic created EJBTimer or cancel the original schedule to avoid trouble. But I don't know how to cancel the original schedule programmatically or would that need to be done by the websphere admins, if both the original and changed schedules remain active

Also from this document, the removeAutomaticEJBTimers command is used to remove timers from a specified scheduler, but that also seems in the area of a websphere admin, not a developer.

How can a developer programmatically cancel an automatic EJBTimer created by using @Schedule annotation?

I am using Java EE 6 with Websphere 8.5 and EJB 3.1.

like image 359
adbdkb Avatar asked Feb 11 '15 17:02

adbdkb


People also ask

How do you make a non persistent timer?

Nonpersistent programmatic timers are created by calling TimerConfig. setPersistent(false) and passing the TimerConfig object to one of the timer-creation methods. The Date and long parameters of the createTimer methods represent time with the resolution of milliseconds.

What is EJB timer?

The EJB timer service provides a reliable and transactional notification service for timed events. Timer notifications may be scheduled to occur at a specific time, after a specific elapsed duration, or at specific recurring intervals. You can define callback methods on your EJB to receive these time-based events.


1 Answers

Do the following to remove persisted EJB timers:

Delete directory jboss-home\standalone\data\timer-service-data{yourporjectname}.{serivename}

like image 186
Saket Chaudhari Avatar answered Nov 01 '22 09:11

Saket Chaudhari