// release the session
statelessRuleSession.release( );
log( "Released Stateless Rule Session." );
log( "Runtime API - Stateful Execution" );
// create a StatefulRuleSession
StatefulRuleSession statefulRuleSession = ( StatefulRuleSession )
ruleRuntime.createRuleSession(
uri, new HashMap( ), RuleRuntime.STATEFUL_SESSION_TYPE );
log( "Got Stateful Rule Session " + uri );
log( ": " + statefulRuleSession );
// add an Object to the statefulRuleSession
log( "Adding browser User-Agent to session: " + userAgent );
statefulRuleSession.addObjects( inputList );
log( "Called addObject on Stateful Rule Session: "
+ statefulRuleSession );
statefulRuleSession.executeRules( );
log( "Called executeRules" );
// extract the Objects from the statefulRuleSession
resultList = statefulRuleSession.getObjects( );
log( "Result of calling getObjects: " + resultList );
// release the statefulRuleSession so it is reset and repooled
statefulRuleSession.release( );
log( "Released Stateful Rule Session." );
}