public class ResultHolderResultQueue
extends java.lang.Object
ResultQueue
that throttles the number of
expected results, limiting it to a maximum at any given time.Constructor and Description |
---|
ResultHolderResultQueue(int throttleLimit) |
Modifier and Type | Method and Description |
---|---|
void |
expect()
Tell the queue to expect one more result.
|
boolean |
isEmpty()
Used by manager thread to verify that there are results available from
take() without possibly having to block and wait. |
boolean |
isExpecting()
Check if any results are expected.
|
void |
put(org.springframework.batch.repeat.support.ResultHolder holder)
Once it is expecting a result, clients call this method to satisfy the
expectation.
|
org.springframework.batch.repeat.support.ResultHolder |
take()
Get the next result as soon as it becomes available.
|
public ResultHolderResultQueue(int throttleLimit)
throttleLimit
- the maximum number of results that can be expected
at any given time.public boolean isEmpty()
take()
without possibly having to block and wait.public boolean isExpecting()
public void expect() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the call blocks and is then interrupted.ResultQueue.expect()
public void put(org.springframework.batch.repeat.support.ResultHolder holder) throws java.lang.IllegalArgumentException
holder
- the result for later collection.java.lang.IllegalArgumentException
- if the queue is not expecting a new
resultpublic org.springframework.batch.repeat.support.ResultHolder take() throws java.util.NoSuchElementException, java.lang.InterruptedException
ResultQueue
).java.util.NoSuchElementException
- if there is no result expectedjava.lang.InterruptedException
- if the operation is interrupted while
waitingResultQueue.take()