Hystrix: Latency and Fault Tolerance for Distributed Systems



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

java.lang.Object
  extended by com.netflix.hystrix.collapser.RequestCollapser<BatchReturnType,ResponseType,RequestArgumentType>

@ThreadSafe
public class RequestCollapser<BatchReturnType,ResponseType,RequestArgumentType>
extends java.lang.Object

Requests are submitted to this and batches executed based on size or time. Scoped to either a request or the global application.

Instances of this are retrieved from the RequestCollapserFactory. Must be thread-safe since it exists within a RequestVariable which is request-scoped and can be accessed from multiple threads.


Method Summary
 void shutdown()
          Called from RequestVariable.shutdown() to unschedule the task.
 rx.Observable<ResponseType> submitRequest(RequestArgumentType arg)
          Submit a request to a batch.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

submitRequest

public rx.Observable<ResponseType> submitRequest(RequestArgumentType arg)
Submit a request to a batch. If the batch maxSize is hit trigger the batch immediately.

Parameters:
arg -
Returns:
Observable
Throws:
java.lang.IllegalStateException - if submitting after shutdown

shutdown

public void shutdown()
Called from RequestVariable.shutdown() to unschedule the task.