<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <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"
      type="cite">
      <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
            moz-do-not-send="true"
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 (<a class="moz-txt-link-abbreviated" href="http://www.redhat.com">www.redhat.com</a>)</div>
            <div>cell: 303.523.7885</div>
          </div>
          <span name="x"></span><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
jbpm-dev mailing list
<a class="moz-txt-link-abbreviated" 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">https://lists.jboss.org/mailman/listinfo/jbpm-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>