
Hystrix: Latency and Fault Tolerance for Distributed Systems
com.netflix.hystrix.collapser
Class RequestBatch<BatchReturnType,ResponseType,RequestArgumentType>
java.lang.Object
com.netflix.hystrix.collapser.RequestBatch<BatchReturnType,ResponseType,RequestArgumentType>
- Type Parameters:
BatchReturnType - ResponseType - RequestArgumentType -
public class RequestBatch<BatchReturnType,ResponseType,RequestArgumentType>
- extends java.lang.Object
A batch of requests collapsed together by a RequestCollapser instance. When full or time has expired it will execute and stop accepting further submissions.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RequestBatch
public RequestBatch(HystrixCollapserProperties properties,
HystrixCollapserBridge<BatchReturnType,ResponseType,RequestArgumentType> commandCollapser,
int maxBatchSize)
offer
public rx.Observable<ResponseType> offer(RequestArgumentType arg)
- Returns:
- Observable if offer accepted, null if batch is full, already started or completed
executeBatchIfNotAlreadyStarted
public void executeBatchIfNotAlreadyStarted()
- Collapsed requests are triggered for batch execution and the array of arguments is passed in.
IMPORTANT IMPLEMENTATION DETAILS => The expected contract (responsibilities) of this method implementation is:
- Do NOT block => Do the work on a separate worker thread. Do not perform inline otherwise it will block other requests.
- Set ALL CollapsedRequest response values => Set the response values T on each CollapsedRequest, even if the response is NULL otherwise the user thread waiting on the response will
think a response was never received and will either block indefinitely or will timeout while waiting.
- Parameters:
args -
shutdown
public void shutdown()