Announcement Announcement Module
Collapse
No announcement yet.
Impossible to access triggercontext when scheduling a runnable? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Impossible to access triggercontext when scheduling a runnable?

    Hi, for example when scheduling a runnable like this
    Code:
    @Autowired
    ThreadPoolTaskScheduler scheduler;
    
    [...]
    
    final CronTrigger trigger = new CronTrigger("0/5 * * * * ?");
    
    ScheduledFuture<?> future = scheduler.schedule(new Runnable() {
    
    	@Override
    	public void run() {
    		System.out.println("I'm triggered by cron!");
                    System.out.println("nextExecutionTime: " + trigger.nextExecutionTime(new SimpleTriggerContext()));
    	}
    }, trigger);
    ...it would be nice to access the TriggerContext internally stored in the non-public class ReschedulingRunnable such that its methods lastScheduledExecutionTime(), lastActualExecutionTime() and lastCompletionTime() can be called.

    But that seems to be impossible! True? Why? Will it be possible in a future spring version? Are there other ways to do this?

    EDIT: See https://jira.springsource.org/browse/SPR-8500

    Cheers!
    B.
    Last edited by dhukas; Jul 1st, 2011, 03:36 AM. Reason: added link to jira
Working...
X