<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Jeff, could you please share the
      complete stacktrace for further investigation?<br>
      <br>
      Thanks<br>
      Maciej<br>
      <br>
      W dniu 15.08.2013 16:46, Jeffrey Bride pisze:<br>
    </div>
    <blockquote
      cite="mid:1657691838.2444323.1376578019870.JavaMail.root@redhat.com"
      type="cite">
      <div style="font-family: Arial; font-size: 12pt; color: #000000">
        <p>Hi Maciej.</p>
        <p>Thanks for implementing the canDestroy() function.</p>
        <p>I still get the same "session was previously disposed"
          exception in a JTA environment however <a
            moz-do-not-send="true"
data-mce-href="https://github.com/jbride/jbpm/blob/master/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/PerProcessInstanceRuntimeManager.java#L258"
href="https://github.com/jbride/jbpm/blob/master/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/PerProcessInstanceRuntimeManager.java#L258">this
            implementation</a> of the init() function in the
          PerProcessInstanceRuntimeManager seems to work.</p>
        <p>on line 258, seems that getRuntimeEngine(...) function should
          still be called because it's in that function that
          the DisposeSessionTransactionSynchronization object is
          registered.</p>
        <p>then, using your new canDestroy() function prevents an
          explicit disposal of the session if a transaction exists
          (which in my case it does) prior to committing of that
          transaction.</p>
        <p><br>
        </p>
        <p>thanks!  jeff</p>
        <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;"><b>From:
          </b>"Maciej Swiderski" <a class="moz-txt-link-rfc2396E" href="mailto:mswiders@redhat.com">&lt;mswiders@redhat.com&gt;</a><br>
          <b>To: </b>"Jeffrey Bride" <a class="moz-txt-link-rfc2396E" href="mailto:jbride@redhat.com">&lt;jbride@redhat.com&gt;</a><br>
          <b>Cc: </b>"jbpm-dev" <a class="moz-txt-link-rfc2396E" href="mailto:jbpm-dev@lists.jboss.org">&lt;jbpm-dev@lists.jboss.org&gt;</a><br>
          <b>Sent: </b>Thursday, August 15, 2013 2:09:10 AM<br>
          <b>Subject: </b>Re: [jbpm-dev] dispose sessions in
          PerProcessInstanceRuntimeManager<br>
          <div><br>
          </div>
          <div class="moz-cite-prefix">Jeff, I pushed fix to master, do
            you mind giving it a try in your setup? Hope it fixes the
            issue.<br>
            <br>
            Thanks<br>
            Maciej<br>
            <br>
            W dniu 12.08.2013 18:15, Jeffrey Bride pisze:<br>
          </div>
          <blockquote
            cite="mid:202839594.759289.1376324145666.JavaMail.root@redhat.com">
            <div style="font-family: Arial; font-size: 12pt; color:
              #000000">
              <div>thanks for the explanation.  makes sense.</div>
              <div>i've created this <a moz-do-not-send="true"
                  href="https://bugzilla.redhat.com/show_bug.cgi?id=996205"
                  target="_blank">BZ</a> .</div>
              <div><br>
              </div>
              <div>thanks!  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;"><b>From:
                </b>"Maciej Swiderski" <a moz-do-not-send="true"
                  class="moz-txt-link-rfc2396E"
                  href="mailto:mswiders@redhat.com" target="_blank">&lt;mswiders@redhat.com&gt;</a><br>
                <b>To: </b>"Jeffrey Bride" <a moz-do-not-send="true"
                  class="moz-txt-link-rfc2396E"
                  href="mailto:jbride@redhat.com" target="_blank">&lt;jbride@redhat.com&gt;</a><br>
                <b>Cc: </b>"jbpm-dev" <a moz-do-not-send="true"
                  class="moz-txt-link-rfc2396E"
                  href="mailto:jbpm-dev@lists.jboss.org" target="_blank">&lt;jbpm-dev@lists.jboss.org&gt;</a><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">
                    <div>Hi.</div>
                    <div>  I'm doing a deep dive into the new jbpm6
                      PerProcessInstanceRuntimeManager functionality.</div>
                    <div>  Impressive.</div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                    <div>  One minor observation is that it seems that
                      both the engine.getKieSession().destroy();    and
                         disposeRuntimeEngine(engine);  function
                      calls  in the <a moz-do-not-send="true"
href="https://github.com/droolsjbpm/jbpm/blob/master/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/PerProcessInstanceRuntimeManager.java#L261"
                        target="_blank">init()</a> function are
                      redundant.</div>
                    <div>  Neither of these calls seem necessary.</div>
                    <div>  Previous to these function calls,  an
                      instance of
                       DisposeSessionTransactionSynchronization() was
                      already registered .... which takes care of
                      appropriately disposing the session after the JTA
                      transaction has committed.</div>
                    <div>  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;">  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;">  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;">  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;">  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;">  at
com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.afterCompletion(SynchronizationImple.java:96)</span><br>
                        <span style="font-size: small;">  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 moz-do-not-send="true"
                            class="moz-txt-link-abbreviated"
                            href="http://www.redhat.com" target="_blank">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 moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:jbpm-dev@lists.jboss.org" target="_blank">jbpm-dev@lists.jboss.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/jbpm-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/jbpm-dev</a></pre>
                </blockquote>
                <br>
              </blockquote>
              <div><br>
              </div>
            </div>
          </blockquote>
          <br>
        </blockquote>
        <div><br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>