com.waveset.util
Interface Supplier

All Known Implementing Classes:
AgentResourceAdapter.AgentAccountSupplier

public interface Supplier

Supplier is a Callable-like object that indicates when further calls should not be made. In conjunction with DoubleBufferedQueue, it can be used to provide read-ahead iterator-like function.


Field Summary
static java.lang.String code_id
           
 
Method Summary
 java.lang.Object[] call()
          Obtain the next block of results.
 void close()
          Tell the supplier no further calls will be made.
 int getBlockSize()
          Indicate how many objects are contained in a buffer; this is optimally the maximum size of an array returned from call().
 boolean isComplete()
          Indicate if this Supplier is complete
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values
Method Detail

getBlockSize

public int getBlockSize()
Indicate how many objects are contained in a buffer; this is optimally the maximum size of an array returned from call().

Returns:
the desired buffer size

isComplete

public boolean isComplete()
Indicate if this Supplier is complete

Returns:
true if there is no more data to fetch using call().

close

public void close()
Tell the supplier no further calls will be made. It is guaranteed that this method will be called exactly once.


call

public java.lang.Object[] call()
                        throws java.lang.Exception
Obtain the next block of results. If an Exception is thrown, it will be assumed there is no more data to fetch and close() will be invoked.

Returns:
the array of Objects defining the next block of data
Throws:
java.lang.Exception