Package org.drools.time

Examples of org.drools.time.JobHandle


      delay = timespan - timer.getPeriod();
      if (delay < 0) {
        delay = 0;
      }
    }
    JobHandle jobHandle = this.timerService.scheduleJob(
      processJob, ctx, new TimerTrigger(delay, timer.getPeriod()));
    timer.setJobHandle(jobHandle);
    timers.put(timer.getId(), timer);
  }
View Full Code Here


            long nextTimestamp = Math.max( clock.getCurrentTime() + this.expirationOffset,
                                           ((EventFactHandle) factHandle).getStartTimestamp() + this.expirationOffset );
            JobContext jobctx = new ExpireJobContext( expire,
                                                      workingMemory );
            JobHandle handle = clock.scheduleJob( job,
                                                  jobctx,
                                                  new PointInTimeTrigger( nextTimestamp,
                                                                          null,
                                                                          null ) );
            jobctx.setJobHandle( handle );
View Full Code Here

           
            TimerService clock = inCtx.wm.getTimerService();
           
            JobContext jobctx = new ExpireJobContext( new WorkingMemoryReteExpireAction(factHandle, otn),
                                                      inCtx.wm );
            JobHandle handle = clock.scheduleJob( job,
                                                  jobctx,
                                                  new PointInTimeTrigger( nextTimeStamp,
                                                                          null,
                                                                          null ) );
            jobctx.setJobHandle( handle );
View Full Code Here

    @Test public void removeExistingJob() {
        final Date triggerTime = new Date(1000);
        when( mockTrigger_1.hasNextFireTime() ).thenReturn(triggerTime);

        JobHandle jobHandle = scheduler.scheduleJob(mockJob_1, this.mockContext_1, mockTrigger_1);
        assertThat(scheduler.getTimeToNextJob(), is(triggerTime.getTime()));

        scheduler.removeJob(jobHandle);
        assertThat(scheduler.getTimeToNextJob(), is(-1L));
       
View Full Code Here

        final Date triggerTime_1 = new Date(1000);
        final Date triggerTime_2 = new Date(2000);
        when( mockTrigger_1.hasNextFireTime() ).thenReturn(triggerTime_1);
        when( mockTrigger_2.hasNextFireTime() ).thenReturn(triggerTime_2);

        JobHandle jobHandle_1 = scheduler.scheduleJob(mockJob_1, this.mockContext_1, mockTrigger_1);
        JobHandle jobHandle_2 = scheduler.scheduleJob(mockJob_2, this.mockContext_2, mockTrigger_2);
        assertThat(scheduler.getTimeToNextJob(), is(triggerTime_1.getTime()));

        scheduler.removeJob(jobHandle_1);
        assertThat(scheduler.getTimeToNextJob(), is(triggerTime_2.getTime()));
View Full Code Here

            long nextTimestamp = Math.max( clock.getCurrentTime() + this.expirationOffset,
                                           ((EventFactHandle) factHandle).getEndTimestamp() + this.expirationOffset );
            JobContext jobctx = new ExpireJobContext( expire,
                                                      workingMemory );
            JobHandle handle = clock.scheduleJob( job,
                                                  jobctx,
                                                  new PointInTimeTrigger( nextTimestamp,
                                                                          null,
                                                                          null ) );
            jobctx.setJobHandle( handle );
View Full Code Here

            TimerService clock = inCtx.wm.getTimerService();

            JobContext jobctx = new ExpireJobContext( new WorkingMemoryReteExpireAction( factHandle, otn ),
                                                      inCtx.wm );
            JobHandle handle = clock.scheduleJob( job,
                                                  jobctx,
                                                  new PointInTimeTrigger( nextTimeStamp,
                                                                          null,
                                                                          null ) );
            jobctx.setJobHandle( handle );
View Full Code Here

           
            TimerService clock = inCtx.wm.getTimerService();
           
            JobContext jobctx = new ExpireJobContext( new WorkingMemoryReteExpireAction(factHandle, otn),
                                                      inCtx.wm );
            JobHandle handle = clock.scheduleJob( job,
                                                  jobctx,
                                                  new PointInTimeTrigger( _expire.getNextFireTimestamp(),
                                                                          null,
                                                                          null ) );
            jobctx.setJobHandle( handle );
View Full Code Here

        if ( rightTuple != null ) {
            long nextTimestamp = ((EventFactHandle) rightTuple.getFactHandle()).getStartTimestamp() + stw.getSize();
            JobContext jobctx = new BehaviorJobContext( workingMemory,
                                                        stw,
                                                        context );
            JobHandle handle = clock.scheduleJob( job,
                                                  jobctx,
                                                  new PointInTimeTrigger( nextTimestamp, null, null ) );
            jobctx.setJobHandle( handle );
        }
    }
View Full Code Here

        if ( rightTuple != null ) {
            long nextTimestamp = ((EventFactHandle) rightTuple.getFactHandle()).getStartTimestamp() + this.size;
            JobContext jobctx = new BehaviorJobContext( workingMemory,
                                                        this,
                                                        context );
            JobHandle handle = clock.scheduleJob( job,
                                                  jobctx,
                                                  new PointInTimeTrigger( nextTimestamp, null, null ) );
            jobctx.setJobHandle( handle );
        }
    }
View Full Code Here

TOP

Related Classes of org.drools.time.JobHandle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.