C# 클래스 Gearman.Worker

파일 보기 프로젝트 열기: johnewart/gearman.net 1 사용 예제들

공개 메소드들

메소드 설명
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.

비공개 메소드들

메소드 설명
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.

메소드 상세

Worker() 공개 메소드

Default constructor, initialize empty method map of strings -> delegates
public Worker ( ) : System
리턴 System

Worker() 공개 메소드

Constructor requiring only the host name; the default port of 4730 is used
public Worker ( string host ) : System
host string /// A representing the host to connect to ///
리턴 System

Worker() 공개 메소드

Constructor requiring both the host and the port number to connect to
public Worker ( string host, int port ) : System
host string /// A representing the host to connect to ///
port int /// A port to connect to (if other than the default of 4730) ///
리턴 System

registerFunction() 공개 메소드

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.
public registerFunction ( string taskname, taskdelegate function ) : void
taskname string /// A that is the 'name' of the task being registered with the server ///
function taskdelegate /// A that is the actual callback function /// (must match the specification) ///
리턴 void

run() 공개 메소드

Obligatory run method for the Thread. Runs indefinitely, checking for a job every 2 seconds TODO: make this time adjustable if needed
public run ( ) : void
리턴 void

stopWorkLoop() 공개 메소드

Terminate the work thread.
public stopWorkLoop ( ) : void
리턴 void

workLoop() 공개 메소드

Get this thing going.
public workLoop ( ) : void
리턴 void