ThreadedParseRequestDispatcher Class
Implements an IParseRequestDispatcher that uses a worker thread to process parse requests.
public class ThreadedParseRequestDispatcher : DisposableObjectBase, IParseRequestDispatcher, IDisposable
- Inheritance:
- object DisposableObjectBase object
- Implements:
- IParseRequestDispatcher IDisposable
Constructors
ThreadedParseRequestDispatcher()
Initializes an instance of the class.
public ThreadedParseRequestDispatcher()
ThreadedParseRequestDispatcher(int)
Initializes an instance of the class.
public ThreadedParseRequestDispatcher(int maxThreadCount)
| Parameter | Type | Description |
|---|---|---|
| maxThreadCount | int | The maximum number of worker threads to use. Must be at least |
ThreadedParseRequestDispatcher(int, ThreadPriority)
Initializes an instance of the class.
public ThreadedParseRequestDispatcher(int maxThreadCount, ThreadPriority threadPriority)
| Parameter | Type | Description |
|---|---|---|
| maxThreadCount | int | The maximum number of worker threads to use. Must be at least |
| threadPriority | ThreadPriority | The ThreadPriority to use for the threads. The default value is BelowNormal. |
Properties
IsBusy
Indicates whether the multi-threaded parser service is currently busy processing a request.
public bool IsBusy { get; }
Property Value
- bool:
trueif the multi-threaded parser service is currently busy processing a request; otherwise,false.
PendingRequestCount
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 |
|
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()
Returns an array of the pending requests in the parse request queue.
HasPendingRequest(string)
Indicates 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:
trueif 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:
trueif 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:
trueif a wait occurred; otherwise,false.
Inherited Members
- DisposableObjectBase.Dispose()
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()