Examples of SessionPseudoClock


Examples of org.drools.time.SessionPseudoClock

        Context pathContext = new ResolvingKnowledgeCommandContext( this.contexts.get( path.getName() ) );

        // increment the clock for all the registered ksessions
        for ( StatefulKnowledgeSession ksession : this.ksessions ) {
            SessionPseudoClock clock = (SessionPseudoClock) ksession.getSessionClock();
            long newTime = startTime + step.getDistanceMillis();
            long currentTime = clock.getCurrentTime();

            clock.advanceTime( newTime - currentTime,
                               TimeUnit.MILLISECONDS );
        }

        for ( Command cmd : step.getCommands() ) {
            if ( cmd instanceof NewStatefulKnowledgeSessionCommand ) {
                // instantiate the ksession, set it's clock and register it
                StatefulKnowledgeSession ksession = (StatefulKnowledgeSession) executionHandler.execute( (GenericCommand) cmd,
                                                                                                         pathContext );
                if ( ksession != null ) {
                    SessionPseudoClock clock = (SessionPseudoClock) ksession.getSessionClock();
                    long newTime = startTime + step.getDistanceMillis();
                    long currentTime = clock.getCurrentTime();
                    clock.advanceTime( newTime - currentTime,
                                       TimeUnit.MILLISECONDS );
                    this.ksessions.add( ksession );
                    this.lastReturnValue = ksession;
                }
            } else if ( cmd instanceof GenericCommand ) {
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.