Class ResultHolderResultQueue


  • public class ResultHolderResultQueue
    extends java.lang.Object
    An implementation of the ResultQueue that throttles the number of expected results, limiting it to a maximum at any given time.
    Author:
    Dave Syer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidexpect()
      Tell the queue to expect one more result.
      booleanisEmpty() 
      booleanisExpecting() 
      voidput​(org.springframework.batch.repeat.support.ResultHolder holder) 
      org.springframework.batch.repeat.support.ResultHoldertake()
      Get the next result as soon as it becomes available.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResultHolderResultQueue

        public ResultHolderResultQueue​(int throttleLimit)
        Parameters:
        throttleLimit - the maximum number of results that can be expected at any given time.
    • Method Detail

      • isEmpty

        public boolean isEmpty()
      • isExpecting

        public boolean isExpecting()
      • expect

        public void expect()
                    throws java.lang.InterruptedException
        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:
        java.lang.InterruptedException
        See Also:
        ResultQueue.expect()
      • put

        public void put​(org.springframework.batch.repeat.support.ResultHolder holder)
                 throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • take

        public org.springframework.batch.repeat.support.ResultHolder take()
                                                                   throws java.util.NoSuchElementException,
                                                                          java.lang.InterruptedException
        Get the next result as soon as it becomes available.

        Release result immediately if:
        • There is a result that is continuable.
        Otherwise block if either:
        • There is no result (as per contract of ResultQueue).
        • The number of results is less than the number expected.
        Error if either:
        • Not expecting.
        • Interrupted.
        Throws:
        java.util.NoSuchElementException
        java.lang.InterruptedException
        See Also:
        ResultQueue.take()