com.cliftonsnyder.clutch.mr
Class Reducer

java.lang.Object
  extended by com.cliftonsnyder.clutch.Agent
      extended by com.cliftonsnyder.clutch.mr.Reducer
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable

public class Reducer
extends Agent

a mobile agent representing a reducer

Author:
Clifton L. Snyder
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.cliftonsnyder.clutch.Agent
Agent.State
 
Field Summary
protected  boolean newAgent
           
 
Fields inherited from class com.cliftonsnyder.clutch.Agent
agentState, ancestorList, children, id, level, maxPeers, parent, state
 
Constructor Summary
Reducer()
          an empty, parameterless constructor; this is necessary if the Reducer object is to "play nice" with ProActive
Reducer(ClutchState state)
          constructs a new Reducer object, with maxPeers maximum peers
 
Method Summary
 void addNewMapper(Mapper m)
           
 Agent createAgent(Node newAgentNode, Node newDataNode)
          method to be implemented by subclasses of Agent; this is where the interesting organization of a Clutch network will take place
 boolean hasMapper()
           
 boolean isNew()
          determines whether or not the Agent is newly created or is a current member of a Clutch network
static void main(java.lang.String[] args)
           
 void putReduceTask(ReduceTask task)
           
 void run()
           
 void setMapper(Mapper mapper)
           
 void setNew(boolean newAgent)
           
 void setState(ClutchState state)
          sets the state information for the Agent
 void shutdown()
          shut down the Agent
 java.lang.String status()
          gives a String representation of the current status of the Agent
 java.lang.String toString()
           
 
Methods inherited from class com.cliftonsnyder.clutch.Agent
addChild, getAgentState, getAncestorList, getChildren, getHostName, getID, getLevel, getParent, getRef, isRoot, removeChild, removeChild, setAgentState, setAncestorList, setID, setLevel, setMaxPeers, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

newAgent

protected boolean newAgent
Constructor Detail

Reducer

public Reducer()
an empty, parameterless constructor; this is necessary if the Reducer object is to "play nice" with ProActive


Reducer

public Reducer(ClutchState state)
constructs a new Reducer object, with maxPeers maximum peers

Parameters:
maxPeers - the maximum number of peers that the Reducer will be allowed
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - This main method optionally takes the location of the Reducer's configuration file as a parameter. If the parameter is not supplied, the default location of '$PWD/etc/clutch.properties' is used. If no configuration file exists at that location, the Reducer will fail since it won't have any way of knowing what class to use for it's tasks.

addNewMapper

public void addNewMapper(Mapper m)

createAgent

public Agent createAgent(Node newAgentNode,
                         Node newDataNode)
Description copied from class: Agent
method to be implemented by subclasses of Agent; this is where the interesting organization of a Clutch network will take place

Specified by:
createAgent in class Agent
Returns:
a newly constructed Agent object that is attached to the Clutch network (i.e., has a parent and possibly some children)

hasMapper

public boolean hasMapper()

isNew

public boolean isNew()
Description copied from class: Agent
determines whether or not the Agent is newly created or is a current member of a Clutch network

Specified by:
isNew in class Agent
Returns:
true iff the Agent is newly created, false otherwise

putReduceTask

public void putReduceTask(ReduceTask task)

run

public void run()

setMapper

public void setMapper(Mapper mapper)

setNew

public void setNew(boolean newAgent)

setState

public void setState(ClutchState state)
Description copied from class: Agent
sets the state information for the Agent

Overrides:
setState in class Agent
Parameters:
state - a ClutchState object with local state information about the Agent

shutdown

public void shutdown()
Description copied from class: Agent
shut down the Agent

Specified by:
shutdown in class Agent

status

public java.lang.String status()
Description copied from class: Agent
gives a String representation of the current status of the Agent

Specified by:
status in class Agent
Returns:
a String representation of the current status of the Agent

toString

public java.lang.String toString()
Overrides:
toString in class Agent