Skip to content

Instantly share code, notes, and snippets.

@aheritier
Created March 23, 2015 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aheritier/3945f85b397d5194efc1 to your computer and use it in GitHub Desktop.
Save aheritier/3945f85b397d5194efc1 to your computer and use it in GitHub Desktop.
TestJobWithException.java
package jobs;
import play.Logger;
import play.jobs.Every;
import play.jobs.Job;
@Every("1min")
public class TestJobWithException extends Job {
static int count = 0;
/**
* Here you do the job
*/
@Override
public void doJob() throws Exception {
if (count++ == 3) {
throw new Exception("Bye Bye Job");
} else {
Logger.debug("TestJobWithException launch #%s", count);
}
}
}
@aheritier
Copy link
Author

With such job and play 1.3.0 in logs I have


2015-03-23 10:11:52,169 - DEBUG ~ (TestJobWithException:20) - TestJobWithException launch #1
2015-03-23 10:12:52,186 - DEBUG ~ (TestJobWithException:20) - TestJobWithException launch #2
2015-03-23 10:13:52,206 - DEBUG ~ (TestJobWithException:20) - TestJobWithException launch #3
2015-03-23 10:14:52,232 - ERROR ~

@6lhid4ng1
Error during job execution (jobs.TestJobWithException)

Execution exception (In /app/jobs/TestJobWithException.java around line 18)
Exception occured : Bye Bye Job

play.exceptions.JavaExecutionException: Bye Bye Job
at play.jobs.Job.call(Job.java:208)
at Invocation.Job(Play!)
Caused by: java.lang.Exception: Bye Bye Job
at jobs.TestJobWithException.doJob(TestJobWithException.java:18)
at play.jobs.Job.doJobWithResult(Job.java:53)
at play.jobs.Job$2.apply(Job.java:196)
at play.db.jpa.JPA.withTransaction(JPA.java:234)
at play.db.jpa.JPA.withinFilter(JPA.java:195)
at play.db.jpa.JPAPlugin$TransactionalFilter.withinFilter(JPAPlugin.java:299)
at play.jobs.Job.withinFilter(Job.java:175)
at play.jobs.Job.call(Job.java:194)
... 1 more


And nothing more. The job is never relaunched. Bug or feature ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment