public class Stop extends Sink
An actor that stops execution of a model when it receives a true token on any input channel. This is accomplished by calling finish() on the director, which requests that the current iteration be completed and then the execution be halted. This actor will also call stopFire() which requests that any actors that are firing concurrently in separate threads conclude their firings. This is necessary to support threaded domains like PN. If the input is not connected to anything, then this actor requests a stop whenever it fires.
When exactly this stops the execution depends on the domain. For example, in DE, if an event with time stamp T and value true arrives at this actor, then the current iteration will be concluded, and then the model will halt. Concluding the current iteration means processing all events in the event queue with time stamp T. Thus, it is possible for actors to be invoked after this one is invoked with a true input.
In SDF, if this actor receives true, then the current iteration is concluded and then execution is stopped. Similarly in SR.
In PN, where each actor has its own thread, there is no well-defined notion of an iteration. The finish() method of the manager calls stopFire() on all actors, which for threaded actors results in halting them upon their next attempt to read an input or write an output. When all actor threads have stopped, the iteration concludes and the model halts. NOTE: This is not the best way to stop a PN model! This mechanism is nondeterministic in the sense that there is no way to control exactly what data is produced or consumed on the connections before the model stops. To stop a PN model, it is better to design the model so that all actors are starved of data when the model is to stop. The director will detect this starvation, and halt the model. Nonetheless, if the nondeterminism is acceptable, this actor can be used.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
SingletonParameter |
_hideName
The parameter that hides the name of the actor.
|
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
Stop(CompositeEntity container,
java.lang.String name)
Construct an actor in the specified container with the specified
name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
postfire()
Read one token from each input channel that has a token,
and if any token is true, call finish() on the manager.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
fire, isFireFunctional, isStrict, iterate, prefire, stop, stopFire, terminate
addInitializable, initialize, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public SingletonParameter _hideName
public Stop(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor within the container.IllegalActionException
- If the actor cannot be contained
by the proposed container.NameDuplicationException
- If the name coincides with
an actor already in the container.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If there is no director or
if there is no manager, or if the container is not a
CompositeActor.