Class PseudoClockScheduler

    • Field Detail

      • timer

        protected java.util.concurrent.atomic.AtomicLong timer
      • idCounter

        protected java.util.concurrent.atomic.AtomicLong idCounter
    • Constructor Detail

      • PseudoClockScheduler

        public PseudoClockScheduler()
    • Method Detail

      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
      • getCurrentTime

        public long getCurrentTime()
        Description copied from interface: TimerService
        Returns the current time from the scheduler clock
        Specified by:
        getCurrentTime in interface org.kie.api.time.SessionClock
        Specified by:
        getCurrentTime in interface TimerService
        Returns:
        the current timestamp
      • scheduleJob

        public org.drools.base.time.JobHandle scheduleJob​(Job job,
                                                          JobContext ctx,
                                                          org.drools.base.time.Trigger trigger)
        Description copied from interface: SchedulerService
        Schedule a job for later execution
        Specified by:
        scheduleJob in interface SchedulerService
        Returns:
      • removeJob

        public void removeJob​(org.drools.base.time.JobHandle jobHandle)
        Description copied from interface: SchedulerService
        Remove the job identified by the given job handle from the scheduled queue
        Specified by:
        removeJob in interface SchedulerService
        Parameters:
        jobHandle - the job identity handle
      • advanceTime

        public long advanceTime​(long amount,
                                java.util.concurrent.TimeUnit unit)
        Specified by:
        advanceTime in interface org.kie.api.time.SessionPseudoClock
      • setStartupTime

        public void setStartupTime​(long i)
      • reset

        public void reset()
        Description copied from interface: TimerService
        Reset this service
        Specified by:
        reset in interface TimerService
      • getTimeToNextJob

        public long getTimeToNextJob()
        Description copied from interface: TimerService
        Returns the number of time units (usually ms) to the next scheduled job
        Specified by:
        getTimeToNextJob in interface TimerService
        Returns:
        the number of time units until the next scheduled job or -1 if there is no job scheduled
      • getTimerJobInstances

        public java.util.Collection<TimerJobInstance> getTimerJobInstances​(long id)
        Description copied from interface: TimerService
        This method may return null for some TimerService implementations that do not want the overhead of maintain this.
        Specified by:
        getTimerJobInstances in interface TimerService
        Returns: