All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ajanta.pattern.SplitJoin

java.lang.Object
   |
   +----ajanta.pattern.Pattern
           |
           +----ajanta.pattern.PatternCollection
                   |
                   +----ajanta.pattern.Split
                           |
                           +----ajanta.pattern.SplitJoin

public abstract class SplitJoin
extends Split
This is a specialization of the Split pattern in which the child agents must report their results to some object (usually the parent). This object must implement the Joinable interface. To achieve this join , the parent appends to the child agents' itinerary, an entry to join with the specified object. Each child agent, having accomplished its task, co-locates with the specified object and invokes the join method on it. This is achieved using the colocateAndInvoke primitive with the join method as a parameter. It is an Abstarct class and need to be extended.

See Also:
Split, SplitJoinAll, SplitJoinAny

Constructor Index

 o SplitJoin()
 o SplitJoin(String)

Method Index

 o join()
It calls decements of the Counter, which keeps track how many agents has to synchronize ( including parent).Counter is a Synchronizer object, which is a simple counter implementing a barrier.
 o next(AgentEnv)
It creates child agents equal to the number of the Pattern in the list.
 o setCounter()
It sets counter value, which keeps track how many agents has to synchronize ( including parent).

Constructors

 o SplitJoin
 public SplitJoin()
 o SplitJoin
 public SplitJoin(String childClass)
Parameters:
childClass - name of the class whose instances will be all the child agents created

Methods

 o next
 protected int next(AgentEnv host)
It creates child agents equal to the number of the Pattern in the list. Each Child agent is assigned a Itinerary which contain Pattern from the list of Patterns as the first entry and second entry indicate it to execute join method with the parent agent as a part of meet method. Child agents are signed by the creator's ( current server's) private key and launched by calling start method of the agent. Child agents are registered with the name registry before they are launched. URN of the child agent is of the form
parent URN + "/" + Name of parent + child number
Parent calls its own join method so that it can wait for child agents to join it.

Parameters:
host - AgentEnv of the current agent server
Overrides:
next in class Split
 o setCounter
 protected abstract int setCounter()
It sets counter value, which keeps track how many agents has to synchronize ( including parent). Counter is a Synchronizer object, which is a simple counter implementing a barrier.

 o join
 protected void join()
It calls decements of the Counter, which keeps track how many agents has to synchronize ( including parent).Counter is a Synchronizer object, which is a simple counter implementing a barrier.

Overrides:
join in class PatternCollection

All Packages  Class Hierarchy  This Package  Previous  Next  Index