I have a class
@OnApplicationStart
public class OnStartManager extends Job{
private DataGridServiceManager dataGridServiceManager = null;
@Override
public void doJob() {
dataGridServiceManager = DataGridServiceManagerImpl.getInstance();
}
}
This is executing when the application starts, but it also executes when i access other pages or even the same page. But i want to execute it only once during the start of the application. What should i do to achieve this.
If you are running in DEV mode, Play sometimes automatically restarts the application. This will cause the
@OnApplicationStartjobs to be rerun as well. Maybe this is what you are experiencing?Quote from Jobs section of Play documentation: