<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: In memory TaskClient without Mina or JMS
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/daniele.ulrich">Daniele Ulrich</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/617232#617232">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi Franklin</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks for posting your (very detailled) findings back to the community. As you were able to use the human task service within JTA transaction boundaries maybe we will try the same within a JEE application (and not with Spring).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ol start="1"><li>persistence unit: we had to change the file name for the orm.xml file to something like orm-human-task-service.xml; orm.xml is the default file name and it seems that it will be taken from ANY persistence unit that has access to it. So it could save you some headache if you are using<br/><span class="jive-xml-tag"><strong style="color: #000080;">&lt;mapping-file&gt;</strong></span>META-INF/orm-human-task-service.xml<span style="color: #000080;"><strong>&lt;/mapping-file&gt;</strong> </span></li><li>you can get the source for jbpm here <a class="jive-link-external-small" href="https://github.com/droolsjbpm/jbpm.git">https://github.com/droolsjbpm/jbpm.git</a> (JBoss Tools provides a GIT Client for eclipse, or you can use TortoiseGIT). I started with my patch from Tag 5.0.0, now already 5.1.0-Final is available. I already attached the sources of my patch in my last post. You just have to concentrate at <span style="font-size: 10pt;">org.jbpm.task.service.<span style="font-size: 10pt;">TaskService and </span>org.jbpm.task.service.<span style="font-size: 10pt;">TaskServiceSession where I had to change the handling of the EntityManager (transaction begin, commit, rollback, entityManager.close).</span></span></li><li><span style="font-size: 10pt;">As in org.jbpm.task.service.<span style="font-size: 10pt;">TaskServiceSession a rather strange transaction handling was implemented and I had not enough time to inspect all call stacks in detail, I decided to use some kind of a hack to create the EnttityManager with the help of threadLocalStorage. If you can guarantee that your taskServiceSession is always created and disposed within the same thread and exclusively used by this one and only thread you could make the implementation somewhat simpler by using a simple instance variable for the entityManager. As far as I know the taskServiceSession is not thread safe anyway. My hack ensures that every thread will have an entityManager of its own and that it is only one time created even if a call causes multiple actions on the entityManager - but you have to make sure that threadLocalStorage is freed after closing the session.</span></span></li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-size: 10pt;">Please keep us up to date; I will try to get in contact with the responsible developers for this sub project if we really decide to use this library in our project. Currently we are discussing to write it completely from scratch because it has not so many features implemented or is this mature that we could not do the same in a couple of days. I think the whole architecture should be reconsidered, with a pure business core and several providers for the different contexts this service could be running in.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-size: 10pt;">Regards</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-size: 10pt;"><p><span style="font-size: 10pt;"><p><span style="font-size: 10pt;">Daniele<p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span></p></span></p></span></p><div class="mcePaste" id="_mcePaste" style="position: absolute; top: 0px; left: 0px;"></div></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/617232#617232">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>