Hystrix: Latency and Fault Tolerance for Distributed Systems



com.netflix.hystrix.collapser
Class RequestBatch<BatchReturnType,ResponseType,RequestArgumentType>

java.lang.Object
  extended by 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.


Constructor Summary
RequestBatch(HystrixCollapserProperties properties, HystrixCollapserBridge<BatchReturnType,ResponseType,RequestArgumentType> commandCollapser, int maxBatchSize)
           
 
Method Summary
 void executeBatchIfNotAlreadyStarted()
          Collapsed requests are triggered for batch execution and the array of arguments is passed in.
 rx.Observable<ResponseType> offer(RequestArgumentType arg)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestBatch

public RequestBatch(HystrixCollapserProperties properties,
                    HystrixCollapserBridge<BatchReturnType,ResponseType,RequestArgumentType> commandCollapser,
                    int maxBatchSize)
Method Detail

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:

Parameters:
args -

shutdown

public void shutdown()