" System.out.println( Thread.currentThread().getName() + \"Taken out \" + $p ); \n" +
" if ( list.isEmpty() ) { list.add( $p.getName() ); } \n" +
"end\n" +
"\n"
;
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( new ByteArrayResource( drl.getBytes() ), ResourceType.DRL );
if ( knowledgeBuilder.hasErrors() ) {
fail( knowledgeBuilder.getErrors().toString() );
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( knowledgeBuilder.getKnowledgePackages() );
StatefulKnowledgeSession knowledgeSession = kbase.newStatefulKnowledgeSession();
ArrayList list = new ArrayList();
knowledgeSession.setGlobal( "list", list );