cgl.imr.worker
Class DaemonWorker

java.lang.Object
  extended by cgl.imr.worker.DaemonWorker
All Implemented Interfaces:
Subscribable

public class DaemonWorker
extends Object
implements Subscribable

Main entity that handles most of the server side functionality. DaemonWorker accept messages coming from the pub-sub broker network and perform them appropriately. To run map/reduce computations it uses the java.util.concurrent.Executor functionality.


Constructor Summary
DaemonWorker(int daemonNo, int numMapWorkers)
           
 
Method Summary
static CustomClassLoader getClassLoader(String jobId)
           
 void handleMapperRequest(byte[] request)
          Creates a Mapper to this particular map task.
 void handleMapReduceTermination(byte[] request)
          Removes the cached mappers and the reducers and send a response to the client.
 void handleMapTask(byte[] request)
          Schedules the execution of a map task by finding appropriate mapper object.
 void handleReducerRequest(byte[] request)
          Starts a Reducer to handle the reduce computation.
 void onEvent(byte[] message)
          Listening method for all the incoming messages from the pub-sub broker network.
 void termintate()
          Terminate the DaemonWorker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DaemonWorker

public DaemonWorker(int daemonNo,
                    int numMapWorkers)
             throws TwisterException
Throws:
TwisterException
Method Detail

getClassLoader

public static CustomClassLoader getClassLoader(String jobId)

handleMapperRequest

public void handleMapperRequest(byte[] request)
                         throws TwisterException,
                                PubSubException,
                                SerializationException
Creates a Mapper to this particular map task. The mappers are stored (cached) till the termination of that particular MapReduce computation. Sends a response to the client.

Parameters:
request - - A MapperRequest.
Throws:
TwisterException
PubSubException
SerializationException

handleMapReduceTermination

public void handleMapReduceTermination(byte[] request)
                                throws TwisterException,
                                       PubSubException,
                                       SerializationException
Removes the cached mappers and the reducers and send a response to the client.

Parameters:
request - - An EndMapReduceRequest.
Throws:
TwisterException
PubSubException
SerializationException

handleMapTask

public void handleMapTask(byte[] request)
                   throws TwisterException,
                          SerializationException
Schedules the execution of a map task by finding appropriate mapper object.

Parameters:
request - - A MapTaskRequest.
Throws:
TwisterException
SerializationException

handleReducerRequest

public void handleReducerRequest(byte[] request)
                          throws TwisterException,
                                 PubSubException,
                                 SerializationException
Starts a Reducer to handle the reduce computation. Reducer is also cached and terminated at the end of the MapReduce computation. Sends a response to the client.

Parameters:
request - - A ReducerRequest.
Throws:
TwisterException
PubSubException
SerializationException

onEvent

public void onEvent(byte[] message)
Listening method for all the incoming messages from the pub-sub broker network.

Specified by:
onEvent in interface Subscribable

termintate

public void termintate()
                throws TwisterException
Terminate the DaemonWorker.

Throws:
TwisterException


For comments and suggestions please send e-mail to