Package org.drools.time

Examples of org.drools.time.Trigger


    @Test
    public void testRepeatedExecutionJobWithRemove() throws Exception {
        SessionConfiguration config = new SessionConfiguration();
        config.setClockType(ClockType.REALTIME_CLOCK);
        TimerService timeService = TimerServiceFactory.getTimerService( config );
        Trigger trigger = new DelayedTrigger( new long[] { 100, 100, 100, 100, 100 } );
        HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
        ctx.setLimit( 3 );
        timeService.scheduleJob( new HelloWorldJob(), ctx,  trigger);
        Thread.sleep( 1000 );
        timeService.shutdown();
View Full Code Here


     */
    public static void scheduleAgendaItem(final ScheduledAgendaItem item, InternalAgenda agenda, InternalWorkingMemory wm) {
        String[] calendarNames = item.getRule().getCalendars();
        Calendars calendars = wm.getCalendars();
       
        Trigger trigger = item.getRule().getTimer().createTrigger( ((InternalWorkingMemory)agenda.getWorkingMemory()).getTimerService().getCurrentTime(), calendarNames, calendars);
       
        ActivationTimerJob job = new ActivationTimerJob();       
        ActivationTimerJobContext ctx = new ActivationTimerJobContext( trigger, item, agenda );       
               
        JobHandle jobHandle = ((InternalWorkingMemory)agenda.getWorkingMemory()).getTimerService().scheduleJob( job, ctx, trigger );
View Full Code Here

     * @param wm
     *            The working memory session.
     */
    public static void scheduleAgendaItem(final ScheduledAgendaItem item, InternalAgenda agenda, InternalWorkingMemory wm) {

        Trigger trigger = item.getRule().getTimer().createTrigger( item, wm );
       
        ActivationTimerJob job = new ActivationTimerJob();
        ActivationTimerJobContext ctx = new ActivationTimerJobContext( trigger, item, agenda );
               
        JobHandle jobHandle = ((InternalWorkingMemory)agenda.getWorkingMemory()).getTimerService().scheduleJob( job, ctx, trigger );
View Full Code Here

        public void read(MarshallerReaderContext inCtx) throws IOException, ClassNotFoundException {                      
            int leftTupleId = inCtx.readInt();
            LeftTuple leftTuple = inCtx.terminalTupleMap.get( leftTupleId  );
            ScheduledAgendaItem item = ( ScheduledAgendaItem ) leftTuple.getObject();
           
            Trigger trigger = InputMarshaller.readTrigger( inCtx );
           
            DefaultAgenda agenda = ( DefaultAgenda ) inCtx.wm.getAgenda();
            ActivationTimerJob job = new ActivationTimerJob();
            ActivationTimerJobContext ctx = new ActivationTimerJobContext( trigger, item, agenda );
                   
View Full Code Here

            LeftTuple leftTuple = inCtx.filter.getTuplesCache().get( PersisterHelper.createActivationKey( _activation.getActivation().getPackageName(),
                                                                                                          _activation.getActivation().getRuleName(),
                                                                                                          _activation.getActivation().getTuple() ) );
            ScheduledAgendaItem item = (ScheduledAgendaItem) leftTuple.getObject();
           
            Trigger trigger = ProtobufInputMarshaller.readTrigger( inCtx,
                                                                   _activation.getTrigger() );
           
            DefaultAgenda agenda = ( DefaultAgenda ) inCtx.wm.getAgenda();
            ActivationTimerJob job = new ActivationTimerJob();
            ActivationTimerJobContext ctx = new ActivationTimerJobContext( trigger, item, agenda );
View Full Code Here

   
    public void testSingleExecutionJob() throws Exception {
      SessionConfiguration config = new SessionConfiguration();
      config.setClockType(ClockType.REALTIME_CLOCK);
        TimerService timeService = TimerServiceFactory.getTimerService( config );
        Trigger trigger = new DelayedTrigger( 100 );
        HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
        timeService.scheduleJob( new HelloWorldJob(), ctx,  trigger);       
        Thread.sleep( 500 );
        timeService.shutdown();
        assertEquals( 1, ctx.getList().size() );
View Full Code Here

   
    public void testRepeatedExecutionJob() throws Exception {
      SessionConfiguration config = new SessionConfiguration();
      config.setClockType(ClockType.REALTIME_CLOCK);
        TimerService timeService = TimerServiceFactory.getTimerService( config );
        Trigger trigger = new DelayedTriggernew long[] { 100, 100, 100} );
        HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
        timeService.scheduleJob( new HelloWorldJob(), ctx,  trigger);       
        Thread.sleep( 500 );
        timeService.shutdown();
        assertEquals( 3, ctx.getList().size() );
View Full Code Here

   
  public void testRepeatedExecutionJobWithRemove() throws Exception {
      SessionConfiguration config = new SessionConfiguration();
      config.setClockType(ClockType.REALTIME_CLOCK);
        TimerService timeService = TimerServiceFactory.getTimerService( config );
    Trigger trigger = new DelayedTrigger( new long[] { 100, 100, 100, 100, 100 } );
    HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
    ctx.setLimit( 3 );
    timeService.scheduleJob( new HelloWorldJob(), ctx,  trigger);   
    Thread.sleep( 1000 );
        timeService.shutdown();
View Full Code Here

public class JDKTimerServiceTest extends TestCase {
   
    public void testSingleExecutionJob() throws Exception {
        TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REALTIME_CLOCK );
        Trigger trigger = new DelayedTrigger( 100 );
        HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
        timeService.scheduleJob( new HelloWorldJob(), ctx,  trigger);       
        Thread.sleep( 500 );
        timeService.shutdown();
        assertEquals( 1, ctx.getList().size() );
View Full Code Here

        assertEquals( 1, ctx.getList().size() );
    }   
   
    public void testRepeatedExecutionJob() throws Exception {
        TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REALTIME_CLOCK );
        Trigger trigger = new DelayedTriggernew long[] { 100, 100, 100} );
        HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
        timeService.scheduleJob( new HelloWorldJob(), ctx,  trigger);       
        Thread.sleep( 500 );
        timeService.shutdown();
        assertEquals( 3, ctx.getList().size() );
View Full Code Here

TOP

Related Classes of org.drools.time.Trigger

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.