My goal is to set up a task, running everytime an user connects to the application. To do so I am using Akka with the onStart function put in the Global.java class (it is in the default empty package, I read about this.)
Now the problem is that it works perfectly on localhost, but now that it has been deployed on the dev server (Tomcat) nothing is happening anymore, the onStart is not triggered... I read in this stack question that it seems to be an identified problem, but I could not find the mentionned question or any other question related to this problem and I have no idea what is the issue !
Here is my Global.java class:
import controllers.EmailNotifications;
import play.Application;
import play.GlobalSettings;
import play.libs.Akka;
import scala.concurrent.duration.Duration;
import java.util.concurrent.TimeUnit;
public class Global extends GlobalSettings {
@Override
public void onStart(Application application) {
Akka.system().scheduler().scheduleOnce(
Duration.create(10, TimeUnit.MILLISECONDS),
new Runnable() {
public void run() {
EmailNotifications.prepareEmail();
}
},
Akka.system().dispatcher()
);
}
}
Do you have any idea why I have this problem, and how I could solve it ? I am really clueless...
Thank you for your help !!