Abstraction for queue of IResultHolder objects. Acts a bit like a BlockingQueue with the ability to count the number of items it expects to ever hold. When clients schedule an item to be added they call Expect()}, and then collect the result later with Take(). Result providers in another thread call Put(Object) to notify the expecting client of a new result. More...
Public Member Functions | |
void | Expect () |
In a master-slave pattern, the master calls this method paired with Take() to manage the flow of items. Normally a task is submitted for processing in another thread, at which point the master uses this method to keep track of the number of expected results. It has the personality of an counter increment, rather than a work queue, which is usually managed elsewhere, e.g. by a IExecutor}. Implementations may choose to block here, if they need to limit the number or rate of tasks being submitted. More... | |
void | Put (TB result) |
Once it is expecting a result, clients call this method to satisfy the expectation. In a master-worker pattern, the workers call this method to deposit the result of a finished task on the queue for collection. More... | |
TB | Take () |
Gets the next available result, blocking if there are none yet available. More... | |
bool | IsEmpty () |
Used by master thread to verify that there are results available from Take() without possibly having to block and wait. More... | |
bool | IsExpecting () |
Checks if any results are expected. Usually used by master thread to drain queue when it is finished. More... | |
Detailed Description
Abstraction for queue of IResultHolder objects. Acts a bit like a BlockingQueue with the ability to count the number of items it expects to ever hold. When clients schedule an item to be added they call Expect()}, and then collect the result later with Take(). Result providers in another thread call Put(Object) to notify the expecting client of a new result.
- Template Parameters
-
TB
Member Function Documentation
void Summer.Batch.Infrastructure.Repeat.Support.IResultQueue< TB >.Expect | ( | ) |
In a master-slave pattern, the master calls this method paired with Take() to manage the flow of items. Normally a task is submitted for processing in another thread, at which point the master uses this method to keep track of the number of expected results. It has the personality of an counter increment, rather than a work queue, which is usually managed elsewhere, e.g. by a IExecutor}. Implementations may choose to block here, if they need to limit the number or rate of tasks being submitted.
- Exceptions
-
ThreadInterruptedException if the call blocks and is then interrupted.
bool Summer.Batch.Infrastructure.Repeat.Support.IResultQueue< TB >.IsEmpty | ( | ) |
Used by master thread to verify that there are results available from Take() without possibly having to block and wait.
- Returns
- true if there are no results available
bool Summer.Batch.Infrastructure.Repeat.Support.IResultQueue< TB >.IsExpecting | ( | ) |
Checks if any results are expected. Usually used by master thread to drain queue when it is finished.
- Returns
- true if more results are expected, but possibly not yet available
void Summer.Batch.Infrastructure.Repeat.Support.IResultQueue< TB >.Put | ( | TB | result | ) |
Once it is expecting a result, clients call this method to satisfy the expectation. In a master-worker pattern, the workers call this method to deposit the result of a finished task on the queue for collection.
- Parameters
-
result the result for later collection.
- Exceptions
-
ArgumentException
TB Summer.Batch.Infrastructure.Repeat.Support.IResultQueue< TB >.Take | ( | ) |
Gets the next available result, blocking if there are none yet available.
- Returns
- a result previously deposited
- Exceptions
-
InvalidOperationException if there is no result expected ThreadInterruptedException if the operation is interrupted while waiting
The documentation for this interface was generated from the following file:
- Summer.Batch.Infrastructure/Repeat/Support/IResultQueue.cs