执行器接口设计

    1. public interface HystrixObservable<R> extends HystrixInvokable<R> {
    2. public Observable<R> observe();
    3. public Observable<R> toObservable();
    4. }
    5. // 执行器
    6. public interface HystrixExecutable<R> extends HystrixInvokable<R> {
    7. public R execute();
    8. public Future<R> queue();
    9. public Observable<R> observe();
    10. }

    熔断器配置信息接口

    1. public interface HystrixInvokableInfo<R> {
    2. HystrixCommandGroupKey getCommandGroup();
    3. HystrixCommandKey getCommandKey();
    4. HystrixThreadPoolKey getThreadPoolKey();
    5. String getPublicCacheKey(); //have to use public in the name, as there's already a protected {@link AbstractCommand#getCacheKey()} method.
    6. HystrixCollapserKey getOriginatingCollapserKey();
    7. HystrixCommandMetrics getMetrics();
    8. HystrixCommandProperties getProperties();
    9. boolean isCircuitBreakerOpen();
    10. boolean isExecutionComplete();
    11. boolean isExecutedInThread();
    12. boolean isSuccessfulExecution();
    13. boolean isFailedExecution();
    14. Throwable getFailedExecutionException();
    15. boolean isResponseFromFallback();
    16. boolean isResponseTimedOut();
    17. boolean isResponseShortCircuited();
    18. boolean isResponseFromCache();
    19. boolean isResponseRejected();
    20. boolean isResponseSemaphoreRejected();
    21. boolean isResponseThreadPoolRejected();
    22. List<HystrixEventType> getExecutionEvents();
    23. int getNumberEmissions();
    24. int getNumberFallbackEmissions();
    25. int getNumberCollapsed();
    26. int getExecutionTimeInMilliseconds();
    27. long getCommandRunStartTimeInNanos();
    28. ExecutionResult.EventCounts getEventCounts();
    29. }

    抽象基础信息实现