JGAP

org.jgap.distr
Class Worker

java.lang.Object
  extended by org.jgap.distr.Worker
All Implemented Interfaces:
IWorker

public class Worker
extends java.lang.Object
implements IWorker

Worker implementation. A worker receives commands from an IMaster instance and returns results to the master. A worker can receive commands even when it is working but it can only work on one task at a time

Since:
2.4

Constructor Summary
Worker(java.lang.String a_displayName, MasterInfo a_master, MasterListener a_masterListener)
          Construct the worker and tell him who his master is.
 
Method Summary
 java.lang.String getDisplayName()
           
 java.lang.Object getStatus()
           
 java.lang.Object pause()
          Forces the worker to pause its work (can be resumed)
 java.lang.Object resume()
          Forces the worker to resume a paused work
 java.lang.Object sendCommand(WorkerCommand a_command)
          Lets a server send a command to process to the worker
 java.lang.Object stop()
          Forces the worker to stop its work (cannot be resumed)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Worker

public Worker(java.lang.String a_displayName,
              MasterInfo a_master,
              MasterListener a_masterListener)
Construct the worker and tell him who his master is.

Parameters:
a_displayName - name for imformative purpose
a_master - the master of this worker
a_masterListener - listener for requests from master
Since:
2.4
Method Detail

getDisplayName

public java.lang.String getDisplayName()
Specified by:
getDisplayName in interface IWorker
Returns:
display name of the worker
Since:
2.4

sendCommand

public java.lang.Object sendCommand(WorkerCommand a_command)
Lets a server send a command to process to the worker

Specified by:
sendCommand in interface IWorker
Parameters:
a_command - the command to process
Returns:
status message
Since:
2.4

getStatus

public java.lang.Object getStatus()
Specified by:
getStatus in interface IWorker
Returns:
current status of the entity
Since:
2.4

pause

public java.lang.Object pause()
Forces the worker to pause its work (can be resumed)

Specified by:
pause in interface IWorker
Returns:
status message
Since:
2.4

stop

public java.lang.Object stop()
Forces the worker to stop its work (cannot be resumed)

Specified by:
stop in interface IWorker
Returns:
status message
Since:
2.4

resume

public java.lang.Object resume()
Forces the worker to resume a paused work

Specified by:
resume in interface IWorker
Returns:
status message
Since:
2.4

JGAP