In ColdFusion 9, is there a quick way to find out the next time that a scheduled task will attempt to run?
相关问题
- How to specify argument attributes in CFscript? (C
- Coldfusion date conversion: “2013-11-15T06:11:57.8
- Create scheduled task using Task Scheduler Managed
- ColdFusion Java Method Not Found Exception
- Using task scheduler for running java jar (from ba
相关文章
- How do I prevent SQL injection with ColdFusion
- Schedule Rails Task to run at a certain time
- How to scope closure's variables in CF10?
- What Notable Differences are there between Railo,
- Restarting ColdFusion mail queue
- How to pass additional data to restful API Basic a
- ColdFusion: Application Options Based on Role?
- Best algorithm to Encrypting / Decrypting a string
AFAIK, there is no one line solution. The main method CF uses to calculate the dates is
CronTabEntry.NextRunTime
. TheCronTabEntry
class represents the settings for a single task. TheNextRunTime
method(s) calculate the next potential run date, based on the task's settings. Handling of expired and paused tasks is done elsewhere, at runtime.To duplicate the results you need to call
NextRunTime
and add a bit of logic to handle expired tasks. WhileNextRunTime
method is private, it can still be accessed via reflection, with the help of Method.setAccessible(boolean).I threw together the function below to demonstrate. The bulk of it is the reflection call (which is a bit more verbose in CF than its java equivalent). Anyway, it should return the same dates used by the CF scheduler.
Rules:
Usage:
CFC