[kepler-dev] PN director and prefire/fire methods

Edward A. Lee eal at eecs.berkeley.edu
Tue Mar 17 17:39:57 PDT 2009


In PN, hasToken() always returns true.
This is because PN implements Kahn-MacQueen blocking reads,
which ensures determinism.

I suspect you really want to be using one of the dataflow
directors (SDF or DDF).

Edward


Piotr Domagalski wrote:
> Hi all,
> 
> I'm using some actors implemented in Java along with PN director. They
> are supposed to be fired only when there is data on all of their
> connected input ports. Therefore, I use a prefire() that goes through
> all input ports and uses hasToken() method.
> 
> But the general behavior is rather unexpected:
> 
> - once the prefire() method returns true (i.e. all connected ports
> have a token pending)
> - fire() uses get() to retrieve the tokens, do sth with them and send the output
> - but then, even when there's actually no more tokens, hasToken() once
> again returns true so the prefire() also returns true
> - now we enter fire() but the first get() throws a TerminateProcessException
> 
> So my question is: why hasToken() returns true even though previous
> fire() used get() and retrieved the one and only token in the channel?
> I can live with the current behavior (I rethrow
> TerminateProcessException from fire() or just let it go upwards) but
> I'm interested how this should ideally be done.
> 
> Thanks for hints or general explanation why PN works that way.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eal.vcf
Type: text/x-vcard
Size: 351 bytes
Desc: not available
URL: <http://mercury.nceas.ucsb.edu/kepler/pipermail/kepler-dev/attachments/20090317/a49cad2b/attachment.vcf>


More information about the Kepler-dev mailing list