[rules-users] how to use StatelessSession's asyncExecute

Mark Proctor mproctor at codehaus.org
Tue Jul 31 07:06:15 EDT 2007


    public void testSingleObjectAssert() throws Exception {
        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" );
            }
        }       
              
        assertTrue( futureAssert.getObject() instanceof FactHandle );
        assertEquals( "stilton",
                      list.get( 0 ) );
       
    }


邵俊军 wrote:
> hi,all
>
> I'm a newer at DROOLS. who can give me some example about asyncExecute.
>
> StatelessSession JAVADOC told me" This will assert the object in the 
> background. This is 'send and forget' execution."
>
> but ,when to deal with it? and what should I do
>
> any example code and advice will be popular
>
>
> thanks
>
> Richard.shao
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list