<html><body><div style="font-family: Arial; font-size: 12pt; color: #000000"><div>thanks for the explanation. &nbsp;makes sense.</div><div>i've created this <a data-mce-href="https://bugzilla.redhat.com/show_bug.cgi?id=996205" href="https://bugzilla.redhat.com/show_bug.cgi?id=996205">BZ</a> .</div><div><br></div><div>thanks! &nbsp;jeff</div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Maciej Swiderski" &lt;mswiders@redhat.com&gt;<br><b>To: </b>"Jeffrey Bride" &lt;jbride@redhat.com&gt;<br><b>Cc: </b>"jbpm-dev" &lt;jbpm-dev@lists.jboss.org&gt;<br><b>Sent: </b>Sunday, August 11, 2013 8:19:50 AM<br><b>Subject: </b>Re: [jbpm-dev] dispose sessions in PerProcessInstanceRuntimeManager<br><div><br></div><div class="moz-cite-prefix">Jeff,<br> <br> the calls are there to cover cases when the creation of RuntimeManager are not executed as part of an active transaction since only then the transaction synchronization is registered. I guess that in your case you are within container manager transaction and thus tx synchronization is registered which causes the behavior you described.<br> I'll check that to ensure that the init method will not call the dispose/destroy if it's within active transaction.<br> <br> Just for information as that might not be directly clear why the init method creates session and the disposes/destroys it - it is to ensure that start events will be properly initialized - e.g. timer start event based processes will be by that notified and executed according to definitions.<br> <br> Maciej<br> <br> W dniu 09.08.2013 19:17, Jeffrey Bride pisze:<br></div><blockquote cite="mid:1614626060.14150463.1376068623908.JavaMail.root@redhat.com"><div style="font-family: Arial; font-size: 12pt; color: #000000" data-mce-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 href="https://github.com/droolsjbpm/jbpm/blob/master/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/PerProcessInstanceRuntimeManager.java#L261" target="_blank" data-mce-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;" data-mce-style="font-size: small;">java.lang.IllegalStateException: Illegal method call. This session was previously disposed.</span><br> <span style="font-size: small;" data-mce-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;" data-mce-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;" data-mce-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;" data-mce-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;" data-mce-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;" data-mce-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></span>Jeffrey Bride<div>Senior Principal Solution Architect</div><div><div>Global Partner Enablement</div><div>Red Hat (<a class="moz-txt-link-abbreviated" href="http://www.redhat.com" target="_blank" data-mce-href="http://www.redhat.com">www.redhat.com</a>)</div><div>cell: 303.523.7885</div></div><span></span><br></div></div><br><fieldset class="mimeAttachmentHeader"></fieldset><br><pre>_______________________________________________
jbpm-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:jbpm-dev@lists.jboss.org" target="_blank" data-mce-href="mailto:jbpm-dev@lists.jboss.org">jbpm-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/jbpm-dev" target="_blank" data-mce-href="https://lists.jboss.org/mailman/listinfo/jbpm-dev">https://lists.jboss.org/mailman/listinfo/jbpm-dev</a></pre></blockquote><br></blockquote><div><br></div></div></body></html>