
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
R - public interface HystrixExecutable<R>
Common interface for executables (HystrixCommand and HystrixCollapser) so client code can treat them the same and combine in typed collections if desired.
| Method Summary | |
|---|---|
R |
execute()
Used for synchronous execution of command. |
rx.Observable<R> |
observe()
Used for asynchronous execution of command with a callback by subscribing to the Observable. |
java.util.concurrent.Future<R> |
queue()
Used for asynchronous execution of command. |
| Method Detail |
|---|
R execute()
HystrixCommand execution
HystrixRuntimeException - if an error occurs and a fallback cannot be retrieved
HystrixBadRequestException - if the HystrixCommand instance considers request arguments to be invalid and needs to throw an error that does not represent a system failurejava.util.concurrent.Future<R> queue()
This will queue up the command on the thread pool and return an Future to get the result once it completes.
NOTE: If configured to not run in a separate thread, this will have the same effect as HystrixExecutable.execute() and will block.
We don't throw an exception in that case but just flip to synchronous execution so code doesn't need to change in order to switch a circuit from running a separate thread to the calling thread.
Future<R> Result of HystrixCommand execution
HystrixRuntimeException - if an error occurs and a fallback cannot be retrieved
HystrixBadRequestException - if the HystrixCommand instance considers request arguments to be invalid and needs to throw an error that does not represent a system failurerx.Observable<R> observe()
Observable.
This eagerly starts execution of the command the same as HystrixExecutable.queue() and HystrixExecutable.execute().
A lazy Observable can be obtained from HystrixCommand.toObservable() or HystrixCollapser.toObservable().
Callback Scheduling
HystrixCommandProperties.ExecutionIsolationStrategy.THREAD this defaults to using Schedulers.threadPoolForComputation() for callbacks.HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE this defaults to using Schedulers.immediate() for callbacks.HystrixCommand.toObservable(rx.Scheduler) or HystrixCollapser.toObservable(rx.Scheduler) to schedule the callback differently.
See https://github.com/Netflix/RxJava/wiki for more information.
Observable<R> that executes and calls back with the result of #run() execution or a fallback from #getFallback() if the command fails for any reason.
HystrixRuntimeException - if a fallback does not exist
Observer#onError if a failure occursHystrixBadRequestException - via Observer#onError if invalid arguments or state were used representing a user failure, not a system failure
java.lang.IllegalStateException - if invoked more than once
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||