<!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: blocking task in start-state does not block
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/MohReece">Maurice de Chateau</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/601737#601737">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hey L&#225;szl&#243;,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The point you're missing here is that a <span style="font-family: 'courier new', courier;">task</span> in a <span style="font-family: 'courier new', courier;">start-state</span> has a different purpose than one in a <span style="font-family: 'courier new', courier;">task-node</span> (which is, admittedly, not very clear from the documentation, but could be derived from <a class="jive-link-external-small" href="http://docs.jboss.com/jbpm/v3.2/userguide/html_single/#swimlaneinstarttask">this section</a>).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If you look at the jPDL definition, you'll see that there are only two node types that support <span style="font-family: 'courier new', courier;">task</span>s:</p><ul><li><span style="font-family: 'courier new', courier;">task-node</span>: for human tasks that are part of your business process and are assigned, started and ended <strong>while the process is running</strong>. It has support for the full task lifecycle (e.g. through the optional attributes <span style="font-family: 'courier new', courier;">create-tasks</span> and <span style="font-family: 'courier new', courier;">end-tasks</span>), including the 'blocking' semantics.</li><li><span style="font-family: 'courier new', courier;">start-state</span>: for the sole purpose of being able <strong>to start a process</strong> by means of a human task. And therefore, blocking this makes no sense.</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Take a closer look at the <a class="jive-link-message-small" href="http://community.jboss.org/message/390487#390487">unit test</a> that is shown in the thread you referred to, and you'll see that in the test that has a <span style="font-family: 'courier new', courier;">task </span>in its <span style="font-family: arial, helvetica, sans-serif;">start-state</span>, the process is started through a <code class="jive-code jive-java">createStartTaskInstance()<span style="font-family: arial, helvetica, sans-serif;"> - <code class="jive-code jive-java">taskInstance.end()</code> sequence, before the token ends up waiting in the '<em>going steady</em>' state.</span></code></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: arial, helvetica, sans-serif;">Your unit test starts the process in a different way (through the <span style="font-family: 'courier new', courier;">signal()</span> call on the <span style="font-family: 'courier new', courier;">ProcessInstance</span>). While this is still possible (i.e. having a <span style="font-family: 'courier new', courier;">task </span>in the <span style="font-family: 'courier new', courier;">start-state</span> doesn't prevent you from starting the process in another manner), it also means that in this case that task has no use anymore for this particular instance of the process, and therefore it is ignored completely.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: arial, helvetica, sans-serif;">So if you set out to have a blocking <span style="font-family: 'courier new', courier;">task </span>as the first thing in your process, you need to do so with a <span style="font-family: 'courier new', courier;">task-node</span> that directly follows your <span style="font-family: 'courier new', courier;">start-state</span>. And actually, that's pretty much what you've done in your second unit test - but you just as well may omit your not-so-blocking <span style="font-family: 'courier new', courier;">task </span>from the process definition. <span> ;) </span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: arial, helvetica, sans-serif;">Regards,</span></p><p><span style="font-family: arial, helvetica, sans-serif;">Maurice</span></p></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/601737#601737">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>