Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling EJB Timer (GlassFish 3.1, Java EE 6)

We have a VIP (BIG-IP) that actually moves the web service requests to two nodes each with its own GlassFish server 3.1 and our services deployed. So it is not a true glassfish cluster. My problem is that I have a lot of Scheduler services like the one listed below:

@Schedule(minute = "55", hour = "23", dayOfWeek = "Wed")
public void runScheduledMedicaidPaymentProcess() {

Is there a way for me to disable the EJB Timer Service on one node so that the above method is not run on both nodes when it is 11:55 pm on Wednesday?

I did see the use of _Default pool for Clusters mentioned in Glassfish server document, but as I explained before ours is not a true cluster. Please let me know if there is any way to stop the timer on one so that it is not activated.

like image 509
R D Avatar asked Nov 04 '22 16:11

R D


1 Answers

If you're not using a cluster then you really just have two independent instances. You're going to have to create some sort of semaphore that each method checks (a db column might be a good solution). The method would return whether or not it's okay to run the timer. Each of your instances would call the method but only one instance would end up running the timer.

Or...

Setup a cluster.

like image 105
Preston Avatar answered Dec 05 '22 05:12

Preston