Code example for ScheduledThreadPoolExecutor

Methods: shutdownNow

0
 
    public void shutdown() { 
        // forcing a shutdownNow instead of a regular shutdown() 
        // to avoid delays on shutdown. This is an irreversible  
        // operation anyway, called on session dispose. 
        this.scheduler.shutdownNow();
    } 
 
    public JobHandle scheduleJob(Job job,
            JobContext ctx,
            Trigger trigger) {
        Date date = trigger.hasNextFireTime();
        if (date != null) {
            JDKJobHandle jobHandle = new JDKJobHandle(idCounter.getAndIncrement());
 
            TimerJobInstance jobInstance = jobFactoryManager.createTimerJobInstance(job,
                    ctx,
                    trigger,
                    jobHandle,
                    this);