Class FaultToleranceCommand

  • All Implemented Interfaces:
    com.netflix.hystrix.HystrixExecutable<Object>, com.netflix.hystrix.HystrixInvokable<Object>, com.netflix.hystrix.HystrixInvokableInfo<Object>, com.netflix.hystrix.HystrixObservable<Object>

    public class FaultToleranceCommand
    extends com.netflix.hystrix.HystrixCommand<Object>
    Class FaultToleranceCommand.
    • Field Detail

      • circuitBreaker

        protected final com.netflix.hystrix.HystrixCircuitBreaker circuitBreaker
      • threadPool

        protected final com.netflix.hystrix.HystrixThreadPool threadPool
      • threadPoolKey

        protected final com.netflix.hystrix.HystrixThreadPoolKey threadPoolKey
      • properties

        protected final com.netflix.hystrix.HystrixCommandProperties properties
      • metrics

        protected final com.netflix.hystrix.HystrixCommandMetrics metrics
      • commandGroup

        protected final com.netflix.hystrix.HystrixCommandGroupKey commandGroup
      • eventNotifier

        protected final com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifier eventNotifier
      • concurrencyStrategy

        protected final com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy concurrencyStrategy
      • executionHook

        protected final com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook executionHook
      • fallbackSemaphoreOverride

        protected final com.netflix.hystrix.AbstractCommand.TryableSemaphore fallbackSemaphoreOverride
      • fallbackSemaphorePerCircuit

        protected static final ConcurrentHashMap<String,​com.netflix.hystrix.AbstractCommand.TryableSemaphore> fallbackSemaphorePerCircuit
      • executionSemaphoreOverride

        protected final com.netflix.hystrix.AbstractCommand.TryableSemaphore executionSemaphoreOverride
      • executionSemaphorePerCircuit

        protected static final ConcurrentHashMap<String,​com.netflix.hystrix.AbstractCommand.TryableSemaphore> executionSemaphorePerCircuit
      • timeoutTimer

        protected final AtomicReference<Reference<com.netflix.hystrix.util.HystrixTimer.TimerListener>> timeoutTimer
      • commandState

        protected AtomicReference<com.netflix.hystrix.AbstractCommand.CommandState> commandState
      • threadState

        protected AtomicReference<com.netflix.hystrix.AbstractCommand.ThreadState> threadState
      • executionResult

        protected volatile com.netflix.hystrix.ExecutionResult executionResult
      • isResponseFromCache

        protected volatile boolean isResponseFromCache
      • executionResultAtTimeOfCancellation

        protected volatile com.netflix.hystrix.ExecutionResult executionResultAtTimeOfCancellation
      • commandStartTimestamp

        protected volatile long commandStartTimestamp
      • isCommandTimedOut

        protected final AtomicReference<com.netflix.hystrix.AbstractCommand.TimedOutStatus> isCommandTimedOut
      • endCurrentThreadExecutingCommand

        protected volatile rx.functions.Action0 endCurrentThreadExecutingCommand
      • requestCache

        protected final com.netflix.hystrix.HystrixRequestCache requestCache
      • currentRequestLog

        protected final com.netflix.hystrix.HystrixRequestLog currentRequestLog
      • commandContainsFallback

        protected static ConcurrentHashMap<com.netflix.hystrix.HystrixCommandKey,​Boolean> commandContainsFallback
    • Constructor Detail

      • FaultToleranceCommand

        public FaultToleranceCommand​(CommandRetrier commandRetrier,
                                     String commandKey,
                                     io.helidon.microprofile.faulttolerance.MethodIntrospector introspector,
                                     javax.interceptor.InvocationContext context,
                                     ClassLoader contextClassLoader,
                                     CompletableFuture<?> taskQueued)
        Constructor. Specify a thread pool key if a @Bulkhead is specified on the method. A unique thread pool key will enable setting limits for this command only based on the Bulkhead properties.
        Parameters:
        commandRetrier - The command retrier associated with this command.
        commandKey - The command key.
        introspector - The method introspector.
        context - CDI invocation context.
        contextClassLoader - Context class loader or null if not available.
        taskQueued - Future completed when task has been queued.
    • Method Detail

      • run

        public Object run()
                   throws Exception
        Code to run as part of this command. Called from superclass.
        Specified by:
        run in class com.netflix.hystrix.HystrixCommand<Object>
        Returns:
        Result of command.
        Throws:
        Exception - If an error occurs.
      • execute

        public Object execute()
        Executes this command returning a result or throwing an exception.
        Specified by:
        execute in interface com.netflix.hystrix.HystrixExecutable<Object>
        Overrides:
        execute in class com.netflix.hystrix.HystrixCommand<Object>
        Returns:
        The result.
        Throws:
        RuntimeException - If something goes wrong.
      • observe

        public rx.Observable<R> observe()
        Specified by:
        observe in interface com.netflix.hystrix.HystrixObservable<R extends Object>
      • toObservable

        public rx.Observable<R> toObservable()
        Specified by:
        toObservable in interface com.netflix.hystrix.HystrixObservable<R extends Object>
      • shouldNotBeWrapped

        protected boolean shouldNotBeWrapped​(Throwable arg0)
      • handleThreadEnd

        protected void handleThreadEnd​(com.netflix.hystrix.AbstractCommand<R> arg0)
      • shouldOutputOnNextEvents

        protected boolean shouldOutputOnNextEvents()
      • getFallbackSemaphore

        protected com.netflix.hystrix.AbstractCommand.TryableSemaphore getFallbackSemaphore()
      • getExecutionSemaphore

        protected com.netflix.hystrix.AbstractCommand.TryableSemaphore getExecutionSemaphore()
      • getCommandGroup

        public com.netflix.hystrix.HystrixCommandGroupKey getCommandGroup()
        Specified by:
        getCommandGroup in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getCommandKey

        public com.netflix.hystrix.HystrixCommandKey getCommandKey()
        Specified by:
        getCommandKey in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getThreadPoolKey

        public com.netflix.hystrix.HystrixThreadPoolKey getThreadPoolKey()
        Specified by:
        getThreadPoolKey in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getMetrics

        public com.netflix.hystrix.HystrixCommandMetrics getMetrics()
        Specified by:
        getMetrics in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getProperties

        public com.netflix.hystrix.HystrixCommandProperties getProperties()
        Specified by:
        getProperties in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getCacheKey

        protected String getCacheKey()
      • getPublicCacheKey

        public String getPublicCacheKey()
        Specified by:
        getPublicCacheKey in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isRequestCachingEnabled

        protected boolean isRequestCachingEnabled()
      • getLogMessagePrefix

        protected String getLogMessagePrefix()
      • isCircuitBreakerOpen

        public boolean isCircuitBreakerOpen()
        Specified by:
        isCircuitBreakerOpen in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isExecutionComplete

        public boolean isExecutionComplete()
        Specified by:
        isExecutionComplete in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isExecutedInThread

        public boolean isExecutedInThread()
        Specified by:
        isExecutedInThread in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isSuccessfulExecution

        public boolean isSuccessfulExecution()
        Specified by:
        isSuccessfulExecution in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isFailedExecution

        public boolean isFailedExecution()
        Specified by:
        isFailedExecution in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getFailedExecutionException

        public Throwable getFailedExecutionException()
        Specified by:
        getFailedExecutionException in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getExecutionException

        public Throwable getExecutionException()
      • isResponseFromFallback

        public boolean isResponseFromFallback()
        Specified by:
        isResponseFromFallback in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isResponseTimedOut

        public boolean isResponseTimedOut()
        Specified by:
        isResponseTimedOut in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isResponseShortCircuited

        public boolean isResponseShortCircuited()
        Specified by:
        isResponseShortCircuited in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isResponseFromCache

        public boolean isResponseFromCache()
        Specified by:
        isResponseFromCache in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isResponseSemaphoreRejected

        public boolean isResponseSemaphoreRejected()
        Specified by:
        isResponseSemaphoreRejected in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isResponseThreadPoolRejected

        public boolean isResponseThreadPoolRejected()
        Specified by:
        isResponseThreadPoolRejected in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • isResponseRejected

        public boolean isResponseRejected()
        Specified by:
        isResponseRejected in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getExecutionEvents

        public List<com.netflix.hystrix.HystrixEventType> getExecutionEvents()
        Specified by:
        getExecutionEvents in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getNumberEmissions

        public int getNumberEmissions()
        Specified by:
        getNumberEmissions in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getNumberFallbackEmissions

        public int getNumberFallbackEmissions()
        Specified by:
        getNumberFallbackEmissions in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getNumberCollapsed

        public int getNumberCollapsed()
        Specified by:
        getNumberCollapsed in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getOriginatingCollapserKey

        public com.netflix.hystrix.HystrixCollapserKey getOriginatingCollapserKey()
        Specified by:
        getOriginatingCollapserKey in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getExecutionTimeInMilliseconds

        public int getExecutionTimeInMilliseconds()
        Specified by:
        getExecutionTimeInMilliseconds in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getCommandRunStartTimeInNanos

        public long getCommandRunStartTimeInNanos()
        Specified by:
        getCommandRunStartTimeInNanos in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getEventCounts

        public com.netflix.hystrix.ExecutionResult.EventCounts getEventCounts()
        Specified by:
        getEventCounts in interface com.netflix.hystrix.HystrixInvokableInfo<R extends Object>
      • getExceptionFromThrowable

        protected Exception getExceptionFromThrowable​(Throwable arg0)