Naanou.LookupService.WorkDispatch
Class Dispatch

Work dispatcher, a ThreadPool-type system. Juggles various multithreaded, multinode method call details.

I can't remember if this class if 100% reliable. I think sometimes it has problems matching up replies with their original requests and what not.

Field Summary
Naanou.LookupService.Node node
System.Collections.Hashtable outstanding
System.Random random

Fields inherited from class Naanou.Common.WorkPool
maintainThread, maxWorkerAgeMins, mre, poolMaxSize, poolMRE, queue, threadsInUse, tiuLock

Constructor Summary
Dispatch(Naanou.LookupService.Node node)
         Constructor

Property Summary
Naanou.LookupService.Node Node
         Gets the node reference

Method Summary
void AddWorkState(Naanou.LookupService.WorkDispatch.WorkState state)
         Adds extra work state
string GetSerial()
         Generates an almost unique serial made up of the node's id, current ticks and a random (0-1000) integer.
string GetSerial(Naanou.LookupService.NodeAddress address)
         Generates an almost unique serial made up an address's id, current ticks and a random (0-1000) integer.
void RemoveWorkState(Naanou.LookupService.WorkDispatch.WorkState state)
         Removes work state, ignoring instances
void ResultNotification(string serial, object[] results)
         As results for async remote communications come in, they hit here to be dispatched to original client

Methods inherited from class Naanou.Common.WorkPool
Cancel, Queue

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

node

private Naanou.LookupService.Node node


outstanding

private System.Collections.Hashtable outstanding


random

private System.Random random

Constructor Detail

Dispatch

public Dispatch(Naanou.LookupService.Node node)

Constructor

Parameters:
node - Node
Property Detail

Node

public Naanou.LookupService.Node Node

Gets the node reference

Method Detail

AddWorkState

internal void AddWorkState(Naanou.LookupService.WorkDispatch.WorkState state)

Adds extra work state

Parameters:
state - State to add

GetSerial

internal string GetSerial()

Generates an almost unique serial made up of the node's id, current ticks and a random (0-1000) integer.

Returns:
Serial

GetSerial

public string GetSerial(Naanou.LookupService.NodeAddress address)

Generates an almost unique serial made up an address's id, current ticks and a random (0-1000) integer.

Parameters:
address - Node address
Returns:
Serial

RemoveWorkState

internal void RemoveWorkState(Naanou.LookupService.WorkDispatch.WorkState state)

Removes work state, ignoring instances

Parameters:
state - State to remove

ResultNotification

public void ResultNotification(string serial,
                               object[] results)

As results for async remote communications come in, they hit here to be dispatched to original client

Parameters:
serial - Serial of results
results - Result parameters