In This Article

ThreadedParseRequestDispatcher Class

Implements an IParseRequestDispatcher that uses a worker thread to process parse requests.

public class ThreadedParseRequestDispatcher : DisposableObject, IParseRequestDispatcher, IDisposable
Inheritance:
object DisposableObject object
Implements:
IParseRequestDispatcher IDisposable

Constructors

ThreadedParseRequestDispatcher()

Initializes a new instance of the ThreadedParseRequestDispatcher class.

public ThreadedParseRequestDispatcher()

ThreadedParseRequestDispatcher(int)

Initializes a new instance of the ThreadedParseRequestDispatcher class.

public ThreadedParseRequestDispatcher(int maxThreadCount)
Parameter Type Description
maxThreadCount int

The maximum number of worker threads to use. Must be at least 1, and should not generally exceed the number of processor cores in the machine.

ThreadedParseRequestDispatcher(int, ThreadPriority)

Initializes a new instance of the ThreadedParseRequestDispatcher class.

public ThreadedParseRequestDispatcher(int maxThreadCount, ThreadPriority threadPriority)
Parameter Type Description
maxThreadCount int

The maximum number of worker threads to use. Must be at least 1, and should not generally exceed the number of processor cores in the machine.

threadPriority ThreadPriority

The ThreadPriority to use for the threads. The default value is BelowNormal.

Properties

IsBusy

Gets whether the multi-threaded parser service is currently busy processing a request.

public bool IsBusy { get; }

Property Value

bool:

true if the multi-threaded parser service is currently busy processing a request; otherwise, false.

PendingRequestCount

Gets the number of pending requests remaining in the parse request queue.

public int PendingRequestCount { get; }

Property Value

int:

The number of pending requests remaining in the parse request queue.

Methods

Dispose(bool)

Releases the unmanaged resources used by the object and optionally releases the managed resources.

protected override void Dispose(bool disposing)
Parameter Type Description
disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method is called by the public Dispose method and the Finalize method. Dispose invokes this method with the disposing parameter set to true. Finalize invokes this method with disposing set to false.

GetPendingRequests()

Gets an array of the pending requests in the parse request queue.

public IParseRequest[] GetPendingRequests()

Returns

IParseRequest[]:

An array of the pending requests in the parse request queue.

HasPendingRequest(string)

Returns whether there is currently a pending request with the specified hash key.

public bool HasPendingRequest(string parseHashKey)
Parameter Type Description
parseHashKey string

The parse hash key identifying the request for which to search.

Returns

bool:

true if there is currently a pending request with the specified hash key; otherwise, false.

QueueRequest(IParseRequest)

Adds an IParseRequest to the queue of pending requests.

public void QueueRequest(IParseRequest request)
Parameter Type Description
request IParseRequest

The IParseRequest that should be processed.

RemovePendingRequests(string)

Removes any pending requests in the parse request queue that have the specified hash key.

public int RemovePendingRequests(string parseHashKey)
Parameter Type Description
parseHashKey string

The parse hash key for which to search.

Returns

int:

The number of pending requests that were removed.

WaitForParse(string)

Waits a maximum of 250 milliseconds for the specified request to complete.

public bool WaitForParse(string parseHashKey)
Parameter Type Description
parseHashKey string

The parse hash key identifying the request for which to wait.

Returns

bool:

true if a wait occurred; otherwise, false.

WaitForParse(string, int)

Waits for the specified request to complete, up to a maximum number of milliseconds.

public bool WaitForParse(string parseHashKey, int maximumWaitTime)
Parameter Type Description
parseHashKey string

The parse hash key identifying the request for which to wait.

maximumWaitTime int

The maximum wait time in milliseconds.

Returns

bool:

true if a wait occurred; otherwise, false.

Inherited Members