@Override public void transform() { this.rulesByteArray = this.helper.getSnapshot(); }
this.marshallingHelper = new SessionMarshallingHelper( kbase, conf, env ); MarshallingConfigurationImpl config = (MarshallingConfigurationImpl) this.marshallingHelper.getMarshaller().getMarshallingConfiguration(); config.setMarshallProcessInstances( false ); config.setMarshallWorkItems( false ); this.ksession = this.marshallingHelper.loadSnapshot( this.sessionInfo.getData(), this.ksession, new JpaSessionInitializer(this) );
protected void initNewKnowledgeSession(KieBase kbase, KieSessionConfiguration conf) { this.sessionInfo = new SessionInfo(); // create session but bypass command service this.ksession = kbase.newKieSession( conf, this.env ); initKieSessionMBeans(this.ksession); this.marshallingHelper = new SessionMarshallingHelper( this.ksession, conf ); MarshallingConfigurationImpl config = (MarshallingConfigurationImpl) this.marshallingHelper.getMarshaller().getMarshallingConfiguration(); config.setMarshallProcessInstances( false ); config.setMarshallWorkItems( false ); this.sessionInfo.setJPASessionMashallingHelper( this.marshallingHelper ); ((InternalKnowledgeRuntime) this.ksession).setEndOperationListener( new EndOperationListenerImpl(this.txm, this.sessionInfo ) ); this.runner = new TransactionInterceptor(); TimerJobFactoryManager timerJobFactoryManager = ((InternalKnowledgeRuntime) ksession ).getTimerService().getTimerJobFactoryManager(); if (timerJobFactoryManager instanceof CommandServiceTimerJobFactoryManager) { ( (CommandServiceTimerJobFactoryManager) timerJobFactoryManager ).setRunner( this ); } }
@Override public void destroy() { PersistenceContext persistenceContext = this.jpm.getApplicationScopedPersistenceContext(); boolean transactionOwner = false; try { transactionOwner = txm.begin(); persistenceContext.joinTransaction(); initExistingKnowledgeSession( this.sessionInfo.getId(), this.marshallingHelper.getKbase(), this.marshallingHelper.getConf(), persistenceContext ); persistenceContext.remove(this.sessionInfo); txm.commit( transactionOwner ); } catch ( RuntimeException re ) { rollbackTransaction( re, transactionOwner ); throw re; } catch ( Exception t1 ) { rollbackTransaction(t1, transactionOwner); throw new RuntimeException( "Wrapped exception see cause", t1 ); } }
sessionInfo.setJPASessionMashallingHelper(new SessionMarshallingHelper( ksession.getKieBase(), ksession.getSessionConfiguration(), ksession.getEnvironment()));