Hello Peter,<br><br>Thank you for your quick response. I am very clear after reading your reply as well as referring to PNQueueReceiver class. I can actually associate this with the problem I came across before. I understand that the process will be blocked till a token is received but I don't understand the other option of workflow terminating. Does the PN director decides to stop the workflow since one of the process is blocked or do we explicitly stop the execution of the workflow. In my case, the workflow stops executing by itself.<br>
<br><div class="gmail_quote">On Wed, Oct 21, 2009 at 4:28 PM, Peter Reutemann <span dir="ltr"><<a href="mailto:fracpete@gmail.com">fracpete@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">> I am trying to implement an actor that has two input ports-input and window.<br>
> In the implementation, I want that the actor should execute different set of<br>
> lines depending on if the tokens are present or not present at the window<br>
> port. I am trying to do something like:<br>
> if(window.hasToken()){<br>
>   ArrayToken tokenD = (ArrayToken) input.get(0);<br>
> System.out.println("There is a token at the window port");<br>
> }<br>
> else<br>
>  System.out.println("There is no token at the window port");<br>
><br>
> I observer that when I use a PN director, the value of  window.hasToken() is<br>
> true even if there is no token at the window port. I actually used an<br>
> arraytosequence actor to output the array tokens to my actor.So even if the<br>
> input to arraytosequence is { }, my actor returns true for window.hasToken()<br>
> and enters the "if" block. However after executing the first line of the<br>
> "if" block, it stops i.e it does not print the next line. Can someone tell<br>
> me why the PN director sets the value false when there is no token at the<br>
> window port?<br>
<br>
</div></div>Stumbled across that myself...<br>
<br>
>From what I understand: the PN domain always assumes that there are<br>
tokens available in the queues, at one point or another (the<br>
ptolemy.domains.pn.kernel.PNQueueReceiver class always returns "true"<br>
in the "hasToken()" method). Only when using the "get(int)"-method of<br>
the port it is attempted to obtain a token. If none is present at the<br>
moment, then the method won't exit until a token shows up or the<br>
workflow terminates.<br>
<br>
Cheers, Peter<br>
<font color="#888888">--<br>
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ<br>
<a href="http://www.cs.waikato.ac.nz/%7Efracpete/" target="_blank">http://www.cs.waikato.ac.nz/~fracpete/</a>           Ph. +64 (7) 858-5174<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Supriya<br>