Class FaultToleranceCommand

  • All Implemented Interfaces:<Object>,<Object>,<Object>,<Object>

    public class FaultToleranceCommand
    Class FaultToleranceCommand.
    • Field Detail

      • circuitBreaker

        protected final circuitBreaker
      • threadPool

        protected final threadPool
      • threadPoolKey

        protected final threadPoolKey
      • properties

        protected final properties
      • metrics

        protected final metrics
      • commandGroup

        protected final commandGroup
      • eventNotifier

        protected final eventNotifier
      • concurrencyStrategy

        protected final concurrencyStrategy
      • executionHook

        protected final executionHook
      • fallbackSemaphoreOverride

        protected final fallbackSemaphoreOverride
      • fallbackSemaphorePerCircuit

        protected static final ConcurrentHashMap<String,​> fallbackSemaphorePerCircuit
      • executionSemaphoreOverride

        protected final executionSemaphoreOverride
      • executionSemaphorePerCircuit

        protected static final ConcurrentHashMap<String,​> executionSemaphorePerCircuit
      • timeoutTimer

        protected final AtomicReference<Reference<>> timeoutTimer
      • commandState

        protected AtomicReference<> commandState
      • threadState

        protected AtomicReference<> threadState
      • executionResult

        protected volatile executionResult
      • isResponseFromCache

        protected volatile boolean isResponseFromCache
      • executionResultAtTimeOfCancellation

        protected volatile executionResultAtTimeOfCancellation
      • commandStartTimestamp

        protected volatile long commandStartTimestamp
      • isCommandTimedOut

        protected final AtomicReference<> isCommandTimedOut
      • endCurrentThreadExecutingCommand

        protected volatile rx.functions.Action0 endCurrentThreadExecutingCommand
      • requestCache

        protected final requestCache
      • currentRequestLog

        protected final currentRequestLog
      • commandContainsFallback

        protected static ConcurrentHashMap<,​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.
        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<Object>
        Result of command.
        Exception - If an error occurs.
      • execute

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

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

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

        protected boolean shouldNotBeWrapped​(Throwable arg0)
      • handleThreadEnd

        protected void handleThreadEnd​(<R> arg0)
      • shouldOutputOnNextEvents

        protected boolean shouldOutputOnNextEvents()
      • getFallbackSemaphore

        protected getFallbackSemaphore()
      • getExecutionSemaphore

        protected getExecutionSemaphore()
      • getCommandGroup

        public getCommandGroup()
        Specified by:
        getCommandGroup in interface<R extends Object>
      • getCommandKey

        public getCommandKey()
        Specified by:
        getCommandKey in interface<R extends Object>
      • getThreadPoolKey

        public getThreadPoolKey()
        Specified by:
        getThreadPoolKey in interface<R extends Object>
      • getMetrics

        public getMetrics()
        Specified by:
        getMetrics in interface<R extends Object>
      • getProperties

        public getProperties()
        Specified by:
        getProperties in interface<R extends Object>
      • getCacheKey

        protected String getCacheKey()
      • getPublicCacheKey

        public String getPublicCacheKey()
        Specified by:
        getPublicCacheKey in interface<R extends Object>
      • isRequestCachingEnabled

        protected boolean isRequestCachingEnabled()
      • getLogMessagePrefix

        protected String getLogMessagePrefix()
      • isCircuitBreakerOpen

        public boolean isCircuitBreakerOpen()
        Specified by:
        isCircuitBreakerOpen in interface<R extends Object>
      • isExecutionComplete

        public boolean isExecutionComplete()
        Specified by:
        isExecutionComplete in interface<R extends Object>
      • isExecutedInThread

        public boolean isExecutedInThread()
        Specified by:
        isExecutedInThread in interface<R extends Object>
      • isSuccessfulExecution

        public boolean isSuccessfulExecution()
        Specified by:
        isSuccessfulExecution in interface<R extends Object>
      • isFailedExecution

        public boolean isFailedExecution()
        Specified by:
        isFailedExecution in interface<R extends Object>
      • getFailedExecutionException

        public Throwable getFailedExecutionException()
        Specified by:
        getFailedExecutionException in interface<R extends Object>
      • getExecutionException

        public Throwable getExecutionException()
      • isResponseFromFallback

        public boolean isResponseFromFallback()
        Specified by:
        isResponseFromFallback in interface<R extends Object>
      • isResponseTimedOut

        public boolean isResponseTimedOut()
        Specified by:
        isResponseTimedOut in interface<R extends Object>
      • isResponseShortCircuited

        public boolean isResponseShortCircuited()
        Specified by:
        isResponseShortCircuited in interface<R extends Object>
      • isResponseFromCache

        public boolean isResponseFromCache()
        Specified by:
        isResponseFromCache in interface<R extends Object>
      • isResponseSemaphoreRejected

        public boolean isResponseSemaphoreRejected()
        Specified by:
        isResponseSemaphoreRejected in interface<R extends Object>
      • isResponseThreadPoolRejected

        public boolean isResponseThreadPoolRejected()
        Specified by:
        isResponseThreadPoolRejected in interface<R extends Object>
      • isResponseRejected

        public boolean isResponseRejected()
        Specified by:
        isResponseRejected in interface<R extends Object>
      • getExecutionEvents

        public List<> getExecutionEvents()
        Specified by:
        getExecutionEvents in interface<R extends Object>
      • getNumberEmissions

        public int getNumberEmissions()
        Specified by:
        getNumberEmissions in interface<R extends Object>
      • getNumberFallbackEmissions

        public int getNumberFallbackEmissions()
        Specified by:
        getNumberFallbackEmissions in interface<R extends Object>
      • getNumberCollapsed

        public int getNumberCollapsed()
        Specified by:
        getNumberCollapsed in interface<R extends Object>
      • getOriginatingCollapserKey

        public getOriginatingCollapserKey()
        Specified by:
        getOriginatingCollapserKey in interface<R extends Object>
      • getExecutionTimeInMilliseconds

        public int getExecutionTimeInMilliseconds()
        Specified by:
        getExecutionTimeInMilliseconds in interface<R extends Object>
      • getCommandRunStartTimeInNanos

        public long getCommandRunStartTimeInNanos()
        Specified by:
        getCommandRunStartTimeInNanos in interface<R extends Object>
      • getEventCounts

        public getEventCounts()
        Specified by:
        getEventCounts in interface<R extends Object>
      • getExceptionFromThrowable

        protected Exception getExceptionFromThrowable​(Throwable arg0)