marshaller.marshall( out,
ksession );
out.flush();
out.close();
ObjectInputStream in = new DroolsObjectInputStream( new ByteArrayInputStream( baos.toByteArray() ) );
kbase = (KnowledgeBase) in.readObject();
marshaller = createSerializableMarshaller( kbase );
ksession = (StatefulKnowledgeSession) 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",
results );