ksession.insert( t2 );
ksession.insert( t3 );
ksession.insert( t4 );
//ksession.fireAllRules();
Marshaller marshaller = createSerializableMarshaller( knowledgeBase );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new DroolsObjectOutputStream( baos );
out.writeObject( knowledgeBase );
marshaller.marshall( out,
ksession );
out.flush();
out.close();
ObjectInputStream in = new DroolsObjectInputStream( new ByteArrayInputStream( baos.toByteArray() ) );
knowledgeBase = (KnowledgeBase) in.readObject();
marshaller = createSerializableMarshaller( knowledgeBase );
ksession = marshaller.unmarshall( in );
in.close();
// setting the global again, since it is not serialized with the session
List<List> results = (List<List>) new ArrayList<List>();
ksession.setGlobal( "results",