Class ResultHolderResultQueue
java.lang.Object
org.springframework.batch.repeat.support.ResultHolderResultQueue
An implementation of the
ResultQueue
that throttles the number of expected
results, limiting it to a maximum at any given time.- Author:
- Dave Syer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
expect()
Tell the queue to expect one more result.boolean
isEmpty()
boolean
void
put
(org.springframework.batch.repeat.support.ResultHolder holder) org.springframework.batch.repeat.support.ResultHolder
take()
Get the next result as soon as it becomes available.
-
Constructor Details
-
ResultHolderResultQueue
public ResultHolderResultQueue(int throttleLimit) - Parameters:
throttleLimit
- the maximum number of results that can be expected at any given time.
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
isExpecting
public boolean isExpecting() -
expect
Tell the queue to expect one more result. Blocks until a new result is available if already expecting too many (as determined by the throttle limit).- Throws:
InterruptedException
- See Also:
-
ResultQueue.expect()
-
put
public void put(org.springframework.batch.repeat.support.ResultHolder holder) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
take
public org.springframework.batch.repeat.support.ResultHolder take() throws NoSuchElementException, InterruptedExceptionGet the next result as soon as it becomes available.
Release result immediately if:- There is a result that is continuable.
- There is no result (as per contract of
ResultQueue
). - The number of results is less than the number expected.
- Not expecting.
- Interrupted.
- Throws:
NoSuchElementException
InterruptedException
- See Also:
-
ResultQueue.take()
-