[kepler-users] PN Director Question

supriya gulati supgulati at gmail.com
Wed Oct 21 16:47:38 PDT 2009


Hello Peter,

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.

On Wed, Oct 21, 2009 at 4:28 PM, Peter Reutemann <fracpete at gmail.com> wrote:

> > I am trying to implement an actor that has two input ports-input and
> window.
> > In the implementation, I want that the actor should execute different set
> of
> > lines depending on if the tokens are present or not present at the window
> > port. I am trying to do something like:
> > if(window.hasToken()){
> >   ArrayToken tokenD = (ArrayToken) input.get(0);
> > System.out.println("There is a token at the window port");
> > }
> > else
> >  System.out.println("There is no token at the window port");
> >
> > I observer that when I use a PN director, the value of  window.hasToken()
> is
> > true even if there is no token at the window port. I actually used an
> > arraytosequence actor to output the array tokens to my actor.So even if
> the
> > input to arraytosequence is { }, my actor returns true for
> window.hasToken()
> > and enters the "if" block. However after executing the first line of the
> > "if" block, it stops i.e it does not print the next line. Can someone
> tell
> > me why the PN director sets the value false when there is no token at the
> > window port?
>
> Stumbled across that myself...
>
> From what I understand: the PN domain always assumes that there are
> tokens available in the queues, at one point or another (the
> ptolemy.domains.pn.kernel.PNQueueReceiver class always returns "true"
> in the "hasToken()" method). Only when using the "get(int)"-method of
> the port it is attempted to obtain a token. If none is present at the
> moment, then the method won't exit until a token shows up or the
> workflow terminates.
>
> Cheers, Peter
> --
> Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
> http://www.cs.waikato.ac.nz/~fracpete/<http://www.cs.waikato.ac.nz/%7Efracpete/>          Ph. +64 (7) 858-5174
>



-- 
Regards,
Supriya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20091021/b7e83bd5/attachment.html>


More information about the Kepler-users mailing list