Examples of JDKTimerService


Examples of org.drools.core.time.impl.JDKTimerService

        BrokerWindow window = new BrokerWindow( registry.getCompanies(), exitOnClose );
        window.show();
        //Thread.sleep( 10000 );
        Broker broker = new Broker( window, registry );
       
        TimerService clock = new JDKTimerService(1);
        StockTickPersister source = new StockTickPersister();
        try {
            source.openForRead( new InputStreamReader( BrokerExample.class.getResourceAsStream("/org/drools/examples/broker/data/stocktickstream.dat") ),
                                System.currentTimeMillis() );
        } catch (FileNotFoundException e) {
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

public class TimerServiceFactory {
   
    public static TimerService getTimerService( ClockType type ) {
        switch( type ) {
            case REALTIME_CLOCK:
                return new JDKTimerService();
            case PSEUDO_CLOCK:
                return new PseudoClockScheduler();
        }
        return null;
    }
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

public class TimerServiceFactory {
   
    public static TimerService getTimerService( ClockType type ) {
        switch( type ) {
            case REALTIME_CLOCK:
                return new JDKTimerService();
            case PSEUDO_CLOCK:
                return new PseudoClockScheduler();
        }
        return null;
    }
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

    public void simpleEvictionTest() throws InterruptedException {
        MessageReceiverHandler handler = new GridNodeImpl( "myNode", null ).getMessageReceiverHandler();
        ContextImplWithEviction contextTemp = (ContextImplWithEviction) ((GridNodeServer) handler).getData().getTemp();
        ((ContextImplWithEviction) contextTemp).setEntryEvictionTime(2000); // 2 seconds
        ((ContextImplWithEviction) contextTemp).setEvictionWakeUpTime(1000); // 1 seconds
        JDKTimerService timer = new JDKTimerService(1);
       
        contextTemp.set("myvalue", "value");


        Long evictionWakeUpTime = contextTemp.getEvictionWakeUpTime();


        timer.scheduleJob(new EvictionJob(contextTemp), new MockJobContext(), new MockTrigger(new Date(), evictionWakeUpTime));
        //Set the timestamp for the first time
        contextTemp.set("myvalue", "value");

        Thread.sleep(1000);
       
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

        // create mock objects for the source and the receiver
        final EventSource source = context.mock( EventSource.class );
        final EventReceiver receiver = context.mock( EventReceiver.class );
       
        // create the scheduler used by drools and the feeder to be tested
        JDKTimerService clock = new JDKTimerService(1);
        EventFeeder feeder = new EventFeeder( clock, source, receiver );
       
        // create the expectations
        context.checking( new Expectations() {{
            // there is an event1, so, read and feed
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

    public void simpleEvictionTest() throws InterruptedException {
        MessageReceiverHandler handler = new GridNodeImpl("myNode").getMessageReceiverHandler();
        ContextImplWithEviction contextTemp = (ContextImplWithEviction) ((GridNodeServer) handler).getData().getTemp();
        ((ContextImplWithEviction) contextTemp).setEntryEvictionTime(2000); // 2 seconds
        ((ContextImplWithEviction) contextTemp).setEvictionWakeUpTime(1000); // 1 seconds
        JDKTimerService timer = new JDKTimerService(1);
       
        contextTemp.set("myvalue", "value");


        Long evictionWakeUpTime = contextTemp.getEvictionWakeUpTime();


        timer.scheduleJob(new EvictionJob(contextTemp), new MockJobContext(), new MockTrigger(new Date(), evictionWakeUpTime));
        //Set the timestamp for the first time
        contextTemp.set("myvalue", "value");

        Thread.sleep(1000);
       
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

    public void simpleEvictionTest() throws InterruptedException {
        MessageReceiverHandler handler = new GridNodeImpl("myNode").getMessageReceiverHandler();
        ContextImplWithEviction contextTemp = (ContextImplWithEviction) ((GridNodeServer) handler).getData().getTemp();
        ((ContextImplWithEviction) contextTemp).setEntryEvictionTime(2000); // 2 seconds
        ((ContextImplWithEviction) contextTemp).setEvictionWakeUpTime(1000); // 1 seconds
        JDKTimerService timer = new JDKTimerService(1);

        contextTemp.set("myvalue", "value");


        Long evictionWakeUpTime = contextTemp.getEvictionWakeUpTime();


        timer.scheduleJob(new EvictionJob(contextTemp), null, new MockTrigger(new Date(), evictionWakeUpTime));
        //Set the timestamp for the first time
        contextTemp.set("myvalue", "value");

        Thread.sleep(1000);
       
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

        BrokerWindow window = new BrokerWindow( registry.getCompanies(), exitOnClose );
        window.show();
        //Thread.sleep( 10000 );
        Broker broker = new Broker( window, registry );
       
        TimerService clock = new JDKTimerService(1);
        StockTickPersister source = new StockTickPersister();
        try {
            source.openForRead( new InputStreamReader( BrokerExample.class.getResourceAsStream("/org/drools/examples/broker/data/stocktickstream.dat") ),
                                System.currentTimeMillis() );
        } catch (FileNotFoundException e) {
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

        BrokerWindow window = new BrokerWindow( registry.getCompanies() );
        window.show();
        //Thread.sleep( 10000 );
        Broker broker = new Broker( window, registry );
       
        TimerService clock = new JDKTimerService(1);
        StockTickPersister source = new StockTickPersister();
        try {
            source.openForRead( new InputStreamReader( BrokerExample.class.getResourceAsStream("/org/drools/examples/broker/data/stocktickstream.dat") ),
                                System.currentTimeMillis() );
        } catch (FileNotFoundException e) {
View Full Code Here

Examples of org.drools.time.impl.JDKTimerService

        BrokerWindow window = new BrokerWindow( registry.getCompanies() );
        window.show();
       
        Broker broker = new Broker( window, registry );
       
        TimerService clock = new JDKTimerService(1);
        StockTickPersister source = new StockTickPersister();
        source.openForRead( new InputStreamReader( Main.class.getResourceAsStream( "/stocktickstream.dat" ) ),
                            System.currentTimeMillis() );
       
        EventFeeder feeder = new EventFeeder(clock, source, broker );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.