Created
August 24, 2010 13:20
-
-
Save ikeike443/547537 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- JobsPlugin.java.orig Wed Jun 9 19:48:00 2010 | |
+++ JobsPlugin.java Wed Aug 25 15:42:10 2010 | |
@@ -136,8 +136,14 @@ | |
Job job = (Job) clazz.newInstance(); | |
scheduledJobs.add(job); | |
String value = job.getClass().getAnnotation(Every.class).value(); | |
+ if (value.startsWith("cron.")) { | |
+ value = Play.configuration.getProperty(value); | |
+ } | |
+ | |
value = Expression.evaluate(value, value).toString(); | |
+ if(!"never".equalsIgnoreCase(value)){ | |
executor.scheduleWithFixedDelay(job, Time.parseDuration(value), Time.parseDuration(value), TimeUnit.SECONDS); | |
+ } | |
} catch (InstantiationException ex) { | |
throw new UnexpectedException("Cannot instanciate Job " + clazz.getName()); | |
} catch (IllegalAccessException ex) { | |
@@ -159,7 +165,7 @@ | |
if (cron.startsWith("cron.")) { | |
cron = Play.configuration.getProperty(cron); | |
} | |
- if (cron != null && !cron.equals("")) { | |
+ if (cron != null && !cron.equals("") && !cron.equalsIgnoreCase("never")) { | |
try { | |
Date now = new Date(); | |
cron = Expression.evaluate(cron, cron).toString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment