Do PlayFramework jobs run multiple times?

I have the following Job class (I deleted the actual job code):

@On("0 0 1 * * ?") public class DailyJob extends Job { @Override public void doJob() throws Exception { // I log from here } } 

My journal says that this task is performed several times a day, while it should be done only once a day (at 01:00). Today it was performed 4 times. The code runs on a tomcat instance on my client server. I thought that a site could run on several servers, but I asked about it, and they said only one. So I think 4 is out of the question. However, I did a function lock (on a static object), and inside the lock / synchronization I checked and set the previous execution date (statc - System.currentTimeMillis ()). And if it is less than 10 seconds ago, it must be registered. However, this does not happen, even if the task is performed 4 times in the same second. Therefore, I think this can be done in 4 different environments.

I think it can work in game 1.2.2

Any idea?

+4
source share
1 answer

I remember a similar error recorded in a recent version of the game. Have you tried to use play 1.2.4?

0
source

Source: https://habr.com/ru/post/1386456/


All Articles