Method | Description | |
---|---|---|
Worker ( ) : System |
Default constructor, initialize empty method map of strings -> delegates
|
|
Worker ( string host ) : System |
Constructor requiring only the host name; the default port of 4730 is used
|
|
Worker ( string host, int port ) : System |
Constructor requiring both the host and the port number to connect to
|
|
registerFunction ( string taskname, taskdelegate function ) : void |
Add a task <--> delegate mapping to this worker. A task name is a short string that the worker registers with the manager, for example "reverse". The delegate is a callback that the worker calls when it receives a packet of work to do that has a task name matching the registered name.
|
|
run ( ) : void |
Obligatory run method for the Thread. Runs indefinitely, checking for a job every 2 seconds TODO: make this time adjustable if needed
|
|
stopWorkLoop ( ) : void |
Terminate the work thread.
|
|
workLoop ( ) : void |
Get this thing going.
|
Method | Description | |
---|---|---|
checkForJob ( ) : void |
Checks with the manager for a new job to work on. The manager has a record of all the tasks that the worker is capable of working on, so most of the real work here is done by the manager to find something for the worker to work on. If something is assigned, load the data, execute the callback and then return the data to the manager so that the worker can move on to something else.
|
public Worker ( string host ) : System | ||
host | string |
/// A |
return | System |
public Worker ( string host, int port ) : System | ||
host | string |
/// A |
port | int |
/// A |
return | System |
public registerFunction ( string taskname, taskdelegate function ) : void | ||
taskname | string |
/// A |
function | taskdelegate |
/// A |
return | void |