<html><body><div style="font-family: Arial; font-size: 12pt; color: #000000"><div>Hi.</div><div>&nbsp; I'm doing a deep dive into the new jbpm6 PerProcessInstanceRuntimeManager functionality.</div><div>&nbsp; Impressive.</div><div><br></div><div><br></div><div>&nbsp; One minor observation is that it seems that both the engine.getKieSession().destroy(); &nbsp; &nbsp;and &nbsp; &nbsp;disposeRuntimeEngine(engine); &nbsp;function calls&nbsp;&nbsp;in the <a data-mce-href="https://github.com/droolsjbpm/jbpm/blob/master/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/PerProcessInstanceRuntimeManager.java#L261" href="https://github.com/droolsjbpm/jbpm/blob/master/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/PerProcessInstanceRuntimeManager.java#L261">init()</a> function are redundant.</div><div>&nbsp; Neither of these calls seem necessary.</div><div>&nbsp; Previous to these function calls, &nbsp;an instance of &nbsp;DisposeSessionTransactionSynchronization() was already registered .... which takes care of appropriately disposing the session after the JTA transaction has committed.</div><div>&nbsp; Subsequently, when either (or both) of these redundant calls to close the session prior to the transaction has committed, the following exception occurs:</div><div><br></div><div><p><span style="font-size: small;">java.lang.IllegalStateException: Illegal method call. This session was previously disposed.</span><br><span style="font-size: small;">&nbsp; at org.drools.core.reteoo.DisposedReteooWorkingMemory.getProcessRuntime(DisposedReteooWorkingMemory.java:262) [drools-core-6.1.0-SNAPSHOT.jar:6.1.0-SNAPSHOT]</span><br><span style="font-size: small;">&nbsp; at org.drools.core.impl.StatefulKnowledgeSessionImpl.getProcessRuntime(StatefulKnowledgeSessionImpl.java:868) [drools-core-6.1.0-SNAPSHOT.jar:6.1.0-SNAPSHOT]</span><br><span style="font-size: small;">&nbsp; at org.drools.persistence.SingleSessionCommandService$SynchronizationImpl.afterCompletion(SingleSessionCommandService.java:504) [drools-persistence-jpa-6.1.0-SNAPSHOT.jar:6.1.0-SNAPSHOT]</span><br><span style="font-size: small;">&nbsp; at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.afterCompletion(JtaTransactionSynchronizationAdapter.java:22) [drools-persistence-jpa-6.1.0-SNAPSHOT.jar:6.1.0-SNAPSHOT]</span><br><span style="font-size: small;">&nbsp; at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.afterCompletion(SynchronizationImple.java:96)</span><br><span style="font-size: small;">&nbsp; at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.afterCompletion(TwoPhaseCoordinator.java:402)</span></p></div><div><br></div><div>I'm testing in an EAP6.1 environment using JTA transactions provided by the app server.</div><div>commenting out those apparently redundant function calls does not seem to cause any other negative side effects and the session is still closed by the DisposeSessionTransactionSynchronization instance.</div><div><br></div><div>jeff</div><div><br></div><div>-- <br></div><div><span name="x"></span>Jeffrey Bride<div>Senior Principal Solution Architect</div><div><div>Global Partner Enablement</div><div>Red Hat (www.redhat.com)</div><div>cell: 303.523.7885</div></div><span name="x"></span><br></div></div></body></html>