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(Int32)
Initializes a new instance of the ThreadedParseRequestDispatcher
class.
public ThreadedParseRequestDispatcher(int maxThreadCount)
Parameter | Type | Description |
---|---|---|
maxThreadCount | Int32 | The maximum number of worker threads to use. Must be at least |
ThreadedParseRequestDispatcher(Int32, ThreadPriority)
Initializes a new instance of the ThreadedParseRequestDispatcher
class.
public ThreadedParseRequestDispatcher(int maxThreadCount, ThreadPriority threadPriority)
Parameter | Type | Description |
---|---|---|
maxThreadCount | Int32 | The maximum number of worker threads to use. Must be at least |
threadPriority | ThreadPriority | The |
Properties
IsBusy
Gets whether the multi-threaded parser service is currently busy processing a request.
public bool IsBusy { get; }
Property Value
- Boolean:
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
- Int32:
The number of pending requests remaining in the parse request queue.
Methods
Dispose(Boolean)
Releases the unmanaged resources used by the object and optionally releases the managed resources.
protected override void Dispose(bool disposing)
Parameter | Type | Description |
---|---|---|
disposing | Boolean |
|
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
- Boolean:
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
- Int32:
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
- Boolean:
true
if a wait occurred; otherwise,false
.
WaitForParse(String, Int32)
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 | Int32 | The maximum wait time in milliseconds. |
Returns
- Boolean:
true
if a wait occurred; otherwise,false
.