Hi Madhavi,
The pseudo code does not give me much to go on.
If you look at the put() method in PNQueueReceiver, then you will see:

while(!_terminate) {
   ...
   try {
   ...
   } catch (InterruptedException e) {
                _terminate = true;
   } finally {
       ....
   }
}

if (_terminate) {
            throw new TerminateProcessException("");
}

Also, reset() sets _terminate to false.
requestFinish() sets _terminate to true.

See the documentation for TerminateProcessException at
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/process/TerminateProcessException.html

This exception is thrown to terminate a process. This is only a notification exception that a ProcessDirector uses to terminate all the processes gracefully. It is not an exception that indicates an error in the code or model.

In the process domains (PN and CSP for example), a simulation is terminated only when a deadlock is detected. During a deadlock, the threads corresponding to actors are normally blocked on a method call to the receiver. This exception is normally thrown from these methods, so that the threads can return from the call and terminate themselves.

This class is a standalone class and not derived from the Ptolemy Runtime exceptions as those exceptions indicate an error in the model, while this exception is used for passing of information to the threads.

The run() method in ptolemy.actor.process.ProcessThread has code like

       } else if (thrownWhenIterate instanceof InterruptedException) {
                    // Process was terminated by call to stop();
                    if (_debugging) {
                        _debug("-- Thread was interrupted: "
                                + thrownWhenIterate);
                    }
        }

My guess is that PNQueueReceiver.put() may be throwing an InterruptedException, or PNQueueReceiver.requestFinish() is being called.

I don't see anything obviously wrong with your pseudo code, I suspect the model has unconnected ports or something?

I would need a complete example to look further into this, there are just too many possibilities.

_Christopher


On 8/24/12 10:13 PM, Madhavi Tikhe wrote:

Hi Chris,

Thanks for the reply.  Following is the illustration for the logic I have.

Public TestActor extends TypedAtomicActor

{

TypedIOPort input, output;

Public TestActor (CompositeEntity container , String name ) throws IllegalActionException, NameDuplicationException

{

                Super ( container, name);

                input = createInputPort ( "test");

                output = createOutputPort ("test");

}

Public void fire () throws IllegalActionException

{

                Super.fire();

                If ( some-condition-met)

{

                List <IOPort> ports = this.outputPortList();

                For (IOPort port : ports )

{

                Object value = getValueFor ( port.getName ());

                Token token = createTokenFromObject ( value ) ;

port.send (0, token); // THIS LINE IS THROWING TPE

}

}

}

public void postfire() throws IllegalActionException

{

return doWeWantToStop();

}

}

Regards,

Madhavi

*From:*Christopher Brooks [mailto:[email protected]]
*Sent:* Saturday, August 25, 2012 10:32 AM
*To:* Madhavi Tikhe
*Cc:* kepler-dev
*Subject:* Re: [kepler-dev] Getting TerminateProcessException when sending token from input port to output port

Do you have a small model that illustrates the problem?

_Christopher

On 8/24/12 10:00 PM, Madhavi Tikhe wrote:

    Hi,

    I am trying to send the token to output port on some conditions
    related to my application.

    I am using PN director for my workflow and using port.send
    (0,token) to send the token to next input port.

    I am experiencing the following exception and is blocked on it.

    ptolemy.actor.process.TerminateProcessException: Process terminated.

            at
    ptolemy.domains.pn.kernel.PNQueueReceiver.put(PNQueueReceiver.java:450)

            at
    ptolemy.actor.AbstractReceiver.putToAll(AbstractReceiver.java:347)

            at ptolemy.actor.IOPort.send(IOPort.java:2733)

            at ptolemy.actor.TypedIOPort.send(TypedIOPort.java:484)

    Have you experienced this problem before? Do you have any
    suggestions for this?

    Thanks in advance for the help.

    Madhavi

    DISCLAIMER ========== This e-mail may contain privileged and
    confidential information which is the property of Persistent
    Systems Ltd. It is intended only for the use of the individual or
    entity to which it is addressed. If you are not the intended
    recipient, you are not authorized to read, retain, copy, print,
    distribute or use this message. If you have received this
    communication in error, please notify the sender and delete all
    copies of this message. Persistent Systems Ltd. does not accept
    any liability for virus infected mails.




    _______________________________________________

    Kepler-dev mailing list

    [email protected]  <mailto:[email protected]>

    http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev



--
Christopher Brooks, PMP                       University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841                                (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.


--
Christopher Brooks, PMP                       University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841                                (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670

_______________________________________________
Kepler-dev mailing list
[email protected]
http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev

Reply via email to