Package org.drools.concurrent

Examples of org.drools.concurrent.Future


        StatefulSession session = getSession();

        final Cheese stilton = new Cheese( "stilton",
                                           5 );

        Future futureAssert = session.asyncInsert( stilton );
        Future futureFireAllRules = session.asyncFireAllRules();
       
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }
View Full Code Here


        StatefulSession session = getSession();

        final Cheese stilton = new Cheese( "stilton",
                                           5 );

        Future futureAssert = session.asyncInsert( new Object[] { stilton } );
        Future futureFireAllRules = session.asyncFireAllRules();
       
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }
View Full Code Here

        final Cheese stilton = new Cheese( "stilton",
                                           5 );

        List collection = new ArrayList();
        collection.add( stilton );
        Future futureAssert = session.asyncInsert( collection );
       
        Future futureFireAllRules = session.asyncFireAllRules();
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }
View Full Code Here

        StatefulSession session = getExceptionSession();

        final Cheese brie = new Cheese( "brie",
                                        12 );

        Future futureAssert = session.asyncInsert( brie );

        Future futureFireAllRules = session.asyncFireAllRules();
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }
       

        assertTrue( futureAssert.getObject() instanceof FactHandle );
        assertTrue( futureFireAllRules.exceptionThrown() );
        assertTrue( futureFireAllRules.getException() instanceof Exception );
    }
View Full Code Here

        StatefulSession session = getExceptionSession();

        final Cheese brie = new Cheese( "brie",
                                        12 );

        Future futureAssert = session.asyncInsert( new Object[] { brie } );
        Future futureFireAllRules = session.asyncFireAllRules();
       
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 300 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }
                      
        assertTrue( futureAssert.getObject() instanceof List );
        assertTrue( ((List)futureAssert.getObject()).get( 0 ) instanceof FactHandle );
        assertTrue( futureFireAllRules.getException() instanceof Exception );
    }
View Full Code Here

        final Cheese brie = new Cheese( "brie",
                                        12 );

        List collection = new ArrayList();
        collection.add( brie );
        Future futureAssert = session.asyncInsert( collection );
        Future futureFireAllRules = session.asyncFireAllRules();
       
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }
                      
        assertTrue( futureAssert.getObject() instanceof List );
        assertTrue( ((List)futureAssert.getObject()).get( 0 ) instanceof FactHandle );
        assertTrue( futureFireAllRules.getException() instanceof Exception );
    }
View Full Code Here

        StatefulSession session = getSession();

        final Cheese stilton = new Cheese( "stilton",
                                           5 );       

        Future futureAssert = session.asyncInsert( stilton );              
        Future futureFireAllRules = session.asyncFireAllRules();
       
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }       
View Full Code Here

        StatefulSession session = getSession();

        final Cheese stilton = new Cheese( "stilton",
                                           5 );       

        Future futureAssert = session.asyncInsert( new Object[] { stilton } );               
        Future futureFireAllRules = session.asyncFireAllRules();
       
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }       
View Full Code Here

        final Cheese stilton = new Cheese( "stilton",
                                           5 );       

        List collection = new ArrayList();
        collection.add( stilton );
        Future futureAssert = session.asyncInsert( collection );
       
        Future futureFireAllRules = session.asyncFireAllRules();
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }       
View Full Code Here

        StatefulSession session = getExceptionSession();

        final Cheese brie = new Cheese( "brie",
                                        12 );     

        Future futureAssert = session.asyncInsert( brie );

        Future futureFireAllRules = session.asyncFireAllRules();
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }  
       

        assertTrue( futureAssert.getObject() instanceof FactHandle );       
        assertTrue( futureFireAllRules.exceptionThrown() );
        assertTrue( futureFireAllRules.getException() instanceof Exception );
    }
View Full Code Here

TOP

Related Classes of org.drools.concurrent.Future

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.