JGAP

org.jgap.distr
Class Master

java.lang.Object
  extended by org.jgap.distr.Master

public abstract class Master
extends java.lang.Object

Represents an IMaster instance. Distributes work to IWorker instances. Allows to receive new tasks and send them to the workers when applicable.

Since:
2.3

Constructor Summary
Master(RequestDispatcher a_dispatcher, WorkerListener a_workerListener)
          Constructor.
 
Method Summary
 RequestDispatcher getDispatcher()
           
 MasterInfo getMasterInfo()
           
 WorkerListener getWorkerListener()
           
 void sendToWorker(IWorker a_worker, WorkerCommand a_command)
          Sends a command to a worker.
abstract  void start()
          Starts the master listener.
 void stop()
          Stops the master from being working.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Master

public Master(RequestDispatcher a_dispatcher,
              WorkerListener a_workerListener)
       throws java.lang.Exception
Constructor.

Parameters:
a_dispatcher - the dispatcher to use for requests to workers
a_workerListener - the listener to use for listening to worker messages
Throws:
java.lang.Exception
Since:
2.4
Method Detail

start

public abstract void start()
                    throws java.lang.Exception
Starts the master listener. Implement in specific implementations of Master.

Throws:
java.lang.Exception
Since:
2.4

stop

public void stop()
Stops the master from being working.


getMasterInfo

public MasterInfo getMasterInfo()
Returns:
information about this master
Since:
2.4

sendToWorker

public void sendToWorker(IWorker a_worker,
                         WorkerCommand a_command)
                  throws java.io.IOException
Sends a command to a worker.

Parameters:
a_worker - the worker to send the command to
a_command - the command to send
Throws:
java.io.IOException

getDispatcher

public RequestDispatcher getDispatcher()
Returns:
the RequestDispatcher used
Since:
2.4

getWorkerListener

public WorkerListener getWorkerListener()
Returns:
the WorkerListener used
Since:
2.4

JGAP