Class RegisteredTimerServiceDelegate

  • All Implemented Interfaces:
    org.drools.core.time.InternalSchedulerService, org.drools.core.time.SchedulerService, org.drools.core.time.TimerService, org.kie.api.time.SessionClock

    public class RegisteredTimerServiceDelegate
    extends Object
    implements org.drools.core.time.TimerService, org.drools.core.time.InternalSchedulerService, org.kie.api.time.SessionClock
    Simple delegate for timer service that fetches the real instance of timer service from TimerServiceRegistry under "default" key. That requires TimerService to be registered prior to using this delegate, which usually means before any session is created. This delegate should be configured in session configuration so when initializing it will use right TimerService implementation: Properties conf = new Properties(); conf.setProperty("drools.timerService", "org.jbpm.process.core.timer.impl.RegisteredTimerServiceDelegate"); KieSessionConfiguration sessionConf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(conf);
    • Constructor Detail

      • RegisteredTimerServiceDelegate

        public RegisteredTimerServiceDelegate()
      • RegisteredTimerServiceDelegate

        public RegisteredTimerServiceDelegate​(String timerServiceKey)
    • Method Detail

      • getTimerService

        public org.drools.core.time.TimerService getTimerService()
      • scheduleJob

        public org.drools.core.time.JobHandle scheduleJob​(org.drools.core.time.Job job,
                                                          org.drools.core.time.JobContext ctx,
                                                          org.drools.core.time.Trigger trigger)
        Specified by:
        scheduleJob in interface org.drools.core.time.SchedulerService
      • removeJob

        public boolean removeJob​(org.drools.core.time.JobHandle jobHandle)
        Specified by:
        removeJob in interface org.drools.core.time.SchedulerService
      • setTimerJobFactoryManager

        public void setTimerJobFactoryManager​(org.drools.core.time.impl.TimerJobFactoryManager timerJobFactoryManager)
        Specified by:
        setTimerJobFactoryManager in interface org.drools.core.time.TimerService
      • getTimerJobFactoryManager

        public org.drools.core.time.impl.TimerJobFactoryManager getTimerJobFactoryManager()
        Specified by:
        getTimerJobFactoryManager in interface org.drools.core.time.TimerService
      • internalSchedule

        public void internalSchedule​(org.drools.core.time.impl.TimerJobInstance timerJobInstance)
        Specified by:
        internalSchedule in interface org.drools.core.time.InternalSchedulerService
      • getCurrentTime

        public long getCurrentTime()
        Specified by:
        getCurrentTime in interface org.kie.api.time.SessionClock
        Specified by:
        getCurrentTime in interface org.drools.core.time.TimerService
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface org.drools.core.time.TimerService
      • getTimeToNextJob

        public long getTimeToNextJob()
        Specified by:
        getTimeToNextJob in interface org.drools.core.time.TimerService
      • getTimerJobInstances

        public Collection<org.drools.core.time.impl.TimerJobInstance> getTimerJobInstances​(long id)
        Specified by:
        getTimerJobInstances in interface org.drools.core.time.TimerService
      • reset

        public void reset()
        Specified by:
        reset in interface org.drools.core.time.TimerService