Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TRequestProcessor
Inherited By:
TSingleThreadRequestProcessor
Purpose:
The RequestQueue class implements a RequestProcessor interface which takes requests and places them on a queue for serial retrieval. It also provides interfaces for a handler to take requests off the queue to process them.
The RequestQueue class maintains a simple ordered queue of requests, which are functors, that are designed to perform a specific operation. It is thread-safe, and is used as the means of passing function invocation requests from one thread to another in a concurrency safe fashion.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
None.
Concurrency:
Multithread safe.
Resource Use:
No special requirements.
TRequestQueue ()
Interface Category:
API.
Purpose:
Default constructor.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
virtual ~ TRequestQueue ()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Called to destroy an object. You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::AdoptRequest
virtual void AdoptRequest (TRequest * request)
Interface Category:
API.
Purpose:
Adopts the request and holds onto it until it is removed.
Calling Context:
You can call this function directly.
Parameters:
- TRequest * request -The request to be adopted.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::WaitAndOrphanNextRequest
virtual TRequest * WaitAndOrphanNextRequest ()
Interface Category:
API.
Purpose:
Removes the next pending request. This member function blocks until there is a request that can be removed.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
Returns a valid request object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::OrphanNextPendingRequest
virtual TRequest * OrphanNextPendingRequest ()
Interface Category:
API.
Purpose:
Removes the next pending request. If there is no request on the queue, then NIL is returned.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
Returns either a valid request object or NIL.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::WaitForRequest
virtual void WaitForRequest ()
Interface Category:
API.
Purpose:
Blocks until a request becomes available. It does not return the request however.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
virtual bool IsEmpty ()
Interface Category:
API.
Purpose:
Determines if there are any requests on the queue.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
Returns true if there are some pending requests.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
virtual void Close ()
Interface Category:
API.
Purpose:
Closes the request queue. No requests can be added or removed.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::RemoveExceptionHandler
virtual void RemoveExceptionHandler (const TRequestExceptionHandler &)
Interface Category:
API.
Purpose:
Removes a previously added exception handle from the request processor.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::AddExceptionHandlerAfter
virtual void AddExceptionHandlerAfter (const TRequestExceptionHandler & after, TRequestExceptionHandler * handler)
Interface Category:
API.
Purpose:
Adds a TRequestExceptionHandler after an existing handler. This handler is called after the existing handler, if no previous handler handles the exception.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::AddExceptionHandlerBefore
virtual void AddExceptionHandlerBefore (const TRequestExceptionHandler & before, TRequestExceptionHandler * handler)
Interface Category:
API.
Purpose:
Adds a TRequestExceptionHandler before an existing handler. This handler is called before the existing handler, if no previous handler handles the exception.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::AddExceptionHandlerLast
virtual void AddExceptionHandlerLast (TRequestExceptionHandler * handler)
Interface Category:
API.
Purpose:
Adds a TRequestExceptionHandler before as the last handler to handle exceptions caught by the request processor. This handler is called if no previous handler handles the exception.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::AddExceptionHandlerFirst
virtual void AddExceptionHandlerFirst (TRequestExceptionHandler * handler)
Interface Category:
API.
Purpose:
Adds a TRequestExceptionHandler before as the first handler to handle exceptions caught by the request processor. This handler is called first to handle exceptions caught by the request processor, unless another handler is subsequently added before it.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TRequestQueue::SetRequestQueueObserver
virtual TRequestQueueObserver * SetRequestQueueObserver (TRequestQueueObserver * observerToAlias)
Interface Category:
API.
Purpose:
Sets a request queue observer to observe requests.
Calling Context:
You can call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.