orc.runtime.regions
Class Region

java.lang.Object
  extended by orc.runtime.regions.Region
Direct Known Subclasses:
Execution, SubRegion

public class Region
extends java.lang.Object

Regions are used to track when some (sub-)computation terminates and/or becomes quiescent.

Currently the region methods must be synchronized, because tokens can be killed by independent threads (such as site calls in progress), triggering an update on the region. Maybe we should have a separate queue deal with dead tokens so this isn't necessary.


Constructor Summary
Region()
           
 
Method Summary
protected  void activate()
          Called when this region becomes not quiescent.
 void add(Region r)
          Add an inactive region.
 void add(Token t)
          Add an active token.
 void addActive()
          Add an active token.
 void close()
          Close the region.
protected  void deactivate()
          Called when this region becomes quiescent.
protected  void maybeDeactivate()
          Called when this region might become quiescent.
protected  void onClose()
          Override this in subclasses to handle the closing of the region.
 void putContainedTokens(java.util.Set<Token> acc)
           
 void remove(Region r)
          Remove an inactive region.
 void remove(Token closer)
          Remove an active token.
 void removeActive()
          Remove an active token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Region

public Region()
Method Detail

add

public final void add(Token t)
Add an active token.


add

public final void add(Region r)
Add an inactive region.


remove

public final void remove(Token closer)
Remove an active token.


remove

public final void remove(Region r)
Remove an inactive region.


close

public final void close()
Close the region. This may either be called indirectly, when the last token leaves the region, or directly, when a group cell terminates the corresponding region. This may be safely called multiple times.


onClose

protected void onClose()
Override this in subclasses to handle the closing of the region.


putContainedTokens

public final void putContainedTokens(java.util.Set<Token> acc)

deactivate

protected void deactivate()
Called when this region becomes quiescent.


activate

protected void activate()
Called when this region becomes not quiescent.


maybeDeactivate

protected void maybeDeactivate()
Called when this region might become quiescent. This should check if the region is really quiescent, and call deactivate() if so. This will never be called if the region has already closed.


addActive

public final void addActive()
Add an active token. Tokens are active by default so you should only call this for a token if you previously called removeActive().


removeActive

public void removeActive()
Remove an active token. Tokens are active by default.