SIFWorks ADK 2.0
LoadBalancer Class
NamespacesEdustructures.SifWorks.ToolsLoadBalancer

[This is preliminary documentation and is subject to change.]

A LoadBalancer manages a free pool of Baton objects representing the right of a thread to perform a resource-intensive task.
Declaration Syntax
C#Visual BasicVisual C++
public class LoadBalancer
Public Class LoadBalancer
public ref class LoadBalancer
Members
All MembersConstructorsMethodsPropertiesFields



IconMemberDescription
LoadBalancerLoadBalancerNew(Object, Int32, Int64)
Constructs a LoadBalancer to represent a specific logical task.

AddLoadBalancerListener(ILoadBalancerListener)
Register a LoadBalancerListener with this LoadBalancer. The listener will be called when the free pool is empty and subsequently contains at least two Batons (or one Baton if this LoadBalancer was defined to have a pool size of one).

CheckinBaton(Baton)
Check-in a Baton.

CheckoutBaton()()
Check-out a Baton.

static memberDefine(LoadBalancer)
Define a LoadBalancer that may be subsequently returned by the lookup method.

FreeBatons
Gets the number of Batons

Load
Gets the current load (the number of Batons in use)

static memberlookup(Object)
Lookup a LoadBalancer that was previously defined by the define method.

removeLoadBalancerListener(ILoadBalancerListener)
Remove a LoadBalancerListener previously registered with the addLoadBalancerListener method

TotalBatons
Gets the total number of Batons

static memberTRACE
Remarks

For example, you could create a LoadBalancer that represents the task "query all students" and assign it an initial pool of 5 Batons, meaning at most 5 threads will be able to carry out this task at once. A thread must check out a Baton in order to perform the task, and must release it back to the LoadBalancer when finished.

Refer to the Baton class for a description of how to use the LoadBalancer and Baton classes and the LoadBalancerListener interface. These classes can be used to introduce internal load balancing into an agent to significantly improve scalability when connecting to tens or hundreds of zones concurrently.

Inheritance Hierarchy
Object
LoadBalancer

Assembly: Edustructures.SifWorks.Adk (Module: Edustructures.SifWorks.Adk) Version: 2.0.0.10