private void readWrite(KnowledgeBase knowledgeBase, StatefulKnowledgeSession ksession, KnowledgeSessionConfiguration config) {
try {
Marshaller marshaller = MarshallerFactory.newMarshaller(knowledgeBase);
ByteArrayOutputStream o = new ByteArrayOutputStream();
marshaller.marshall(o, ksession);
ksession = marshaller.unmarshall(new ByteArrayInputStream(o.toByteArray()), config, KnowledgeBaseFactory.newEnvironment());
ksession.fireAllRules();
//scheduler = ksession.getSessionClock();
} catch (Exception e) {
throw new RuntimeException(e);