Class FaultToleranceCommand
- java.lang.Object
-
- com.netflix.hystrix.HystrixCommand<Object>
-
- io.helidon.microprofile.faulttolerance.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 Summary
Fields Modifier and Type Field Description protected com.netflix.hystrix.HystrixCircuitBreakercircuitBreakerprotected static ConcurrentHashMap<com.netflix.hystrix.HystrixCommandKey,Boolean>commandContainsFallbackprotected com.netflix.hystrix.HystrixCommandGroupKeycommandGroupprotected longcommandStartTimestampprotected AtomicReference<com.netflix.hystrix.AbstractCommand.CommandState>commandStateprotected com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategyconcurrencyStrategyprotected com.netflix.hystrix.HystrixRequestLogcurrentRequestLogprotected rx.functions.Action0endCurrentThreadExecutingCommandprotected com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifiereventNotifierprotected com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHookexecutionHookprotected com.netflix.hystrix.ExecutionResultexecutionResultprotected com.netflix.hystrix.ExecutionResultexecutionResultAtTimeOfCancellationprotected com.netflix.hystrix.AbstractCommand.TryableSemaphoreexecutionSemaphoreOverrideprotected static ConcurrentHashMap<String,com.netflix.hystrix.AbstractCommand.TryableSemaphore>executionSemaphorePerCircuitprotected com.netflix.hystrix.AbstractCommand.TryableSemaphorefallbackSemaphoreOverrideprotected static ConcurrentHashMap<String,com.netflix.hystrix.AbstractCommand.TryableSemaphore>fallbackSemaphorePerCircuitprotected AtomicReference<com.netflix.hystrix.AbstractCommand.TimedOutStatus>isCommandTimedOutprotected booleanisResponseFromCacheprotected com.netflix.hystrix.HystrixCommandMetricsmetricsprotected com.netflix.hystrix.HystrixCommandPropertiespropertiesprotected com.netflix.hystrix.HystrixRequestCacherequestCacheprotected com.netflix.hystrix.HystrixThreadPoolthreadPoolprotected com.netflix.hystrix.HystrixThreadPoolKeythreadPoolKeyprotected AtomicReference<com.netflix.hystrix.AbstractCommand.ThreadState>threadStateprotected AtomicReference<Reference<com.netflix.hystrix.util.HystrixTimer.TimerListener>>timeoutTimer
-
Constructor Summary
Constructors Constructor Description FaultToleranceCommand(CommandRetrier commandRetrier, String commandKey, io.helidon.microprofile.faulttolerance.MethodIntrospector introspector, javax.interceptor.InvocationContext context, ClassLoader contextClassLoader, CompletableFuture<?> taskQueued)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ThrowabledecomposeException(Exception arg0)Objectexecute()Executes this command returning a result or throwing an exception.protected StringgetCacheKey()com.netflix.hystrix.HystrixCommandGroupKeygetCommandGroup()com.netflix.hystrix.HystrixCommandKeygetCommandKey()longgetCommandRunStartTimeInNanos()com.netflix.hystrix.ExecutionResult.EventCountsgetEventCounts()protected ExceptiongetExceptionFromThrowable(Throwable arg0)List<com.netflix.hystrix.HystrixEventType>getExecutionEvents()ThrowablegetExecutionException()protected com.netflix.hystrix.AbstractCommand.TryableSemaphoregetExecutionSemaphore()intgetExecutionTimeInMilliseconds()ThrowablegetFailedExecutionException()protected com.netflix.hystrix.AbstractCommand.TryableSemaphoregetFallbackSemaphore()protected StringgetLogMessagePrefix()com.netflix.hystrix.HystrixCommandMetricsgetMetrics()intgetNumberCollapsed()intgetNumberEmissions()intgetNumberFallbackEmissions()com.netflix.hystrix.HystrixCollapserKeygetOriginatingCollapserKey()com.netflix.hystrix.HystrixCommandPropertiesgetProperties()StringgetPublicCacheKey()com.netflix.hystrix.HystrixThreadPoolKeygetThreadPoolKey()protected voidhandleThreadEnd(com.netflix.hystrix.AbstractCommand<R> arg0)booleanisCircuitBreakerOpen()booleanisExecutedInThread()booleanisExecutionComplete()booleanisFailedExecution()protected booleanisRequestCachingEnabled()booleanisResponseFromCache()booleanisResponseFromFallback()booleanisResponseRejected()booleanisResponseSemaphoreRejected()booleanisResponseShortCircuited()booleanisResponseThreadPoolRejected()booleanisResponseTimedOut()booleanisSuccessfulExecution()rx.Observable<R>observe()Objectrun()Code to run as part of this command.protected booleanshouldNotBeWrapped(Throwable arg0)protected booleanshouldOutputOnNextEvents()rx.Observable<R>toObservable()-
Methods inherited from class com.netflix.hystrix.HystrixCommand
commandIsScalar, getExecutionObservable, getFallback, getFallbackMethodName, getFallbackObservable, isFallbackUserDefined, queue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.netflix.hystrix.HystrixInvokableInfo
getCommandGroup, getCommandKey, getCommandRunStartTimeInNanos, getEventCounts, getExecutionEvents, getExecutionTimeInMilliseconds, getFailedExecutionException, getMetrics, getNumberCollapsed, getNumberEmissions, getNumberFallbackEmissions, getOriginatingCollapserKey, getProperties, getPublicCacheKey, getThreadPoolKey, isCircuitBreakerOpen, isExecutedInThread, isExecutionComplete, isFailedExecution, isResponseFromCache, isResponseFromFallback, isResponseRejected, isResponseSemaphoreRejected, isResponseShortCircuited, isResponseThreadPoolRejected, isResponseTimedOut, isSuccessfulExecution
-
-
-
-
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@Bulkheadis specified on the method. A unique thread pool key will enable setting limits for this command only based on theBulkheadproperties.- 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 ornullif 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.
-
execute
public Object execute()
Executes this command returning a result or throwing an exception.- Specified by:
executein interfacecom.netflix.hystrix.HystrixExecutable<Object>- Overrides:
executein classcom.netflix.hystrix.HystrixCommand<Object>- Returns:
- The result.
- Throws:
RuntimeException- If something goes wrong.
-
observe
public rx.Observable<R> observe()
- Specified by:
observein interfacecom.netflix.hystrix.HystrixObservable<R extends Object>
-
toObservable
public rx.Observable<R> toObservable()
- Specified by:
toObservablein interfacecom.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:
getCommandGroupin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getCommandKey
public com.netflix.hystrix.HystrixCommandKey getCommandKey()
- Specified by:
getCommandKeyin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getThreadPoolKey
public com.netflix.hystrix.HystrixThreadPoolKey getThreadPoolKey()
- Specified by:
getThreadPoolKeyin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getMetrics
public com.netflix.hystrix.HystrixCommandMetrics getMetrics()
- Specified by:
getMetricsin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getProperties
public com.netflix.hystrix.HystrixCommandProperties getProperties()
- Specified by:
getPropertiesin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getCacheKey
protected String getCacheKey()
-
getPublicCacheKey
public String getPublicCacheKey()
- Specified by:
getPublicCacheKeyin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isRequestCachingEnabled
protected boolean isRequestCachingEnabled()
-
getLogMessagePrefix
protected String getLogMessagePrefix()
-
isCircuitBreakerOpen
public boolean isCircuitBreakerOpen()
- Specified by:
isCircuitBreakerOpenin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isExecutionComplete
public boolean isExecutionComplete()
- Specified by:
isExecutionCompletein interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isExecutedInThread
public boolean isExecutedInThread()
- Specified by:
isExecutedInThreadin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isSuccessfulExecution
public boolean isSuccessfulExecution()
- Specified by:
isSuccessfulExecutionin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isFailedExecution
public boolean isFailedExecution()
- Specified by:
isFailedExecutionin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getFailedExecutionException
public Throwable getFailedExecutionException()
- Specified by:
getFailedExecutionExceptionin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getExecutionException
public Throwable getExecutionException()
-
isResponseFromFallback
public boolean isResponseFromFallback()
- Specified by:
isResponseFromFallbackin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isResponseTimedOut
public boolean isResponseTimedOut()
- Specified by:
isResponseTimedOutin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isResponseShortCircuited
public boolean isResponseShortCircuited()
- Specified by:
isResponseShortCircuitedin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isResponseFromCache
public boolean isResponseFromCache()
- Specified by:
isResponseFromCachein interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isResponseSemaphoreRejected
public boolean isResponseSemaphoreRejected()
- Specified by:
isResponseSemaphoreRejectedin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isResponseThreadPoolRejected
public boolean isResponseThreadPoolRejected()
- Specified by:
isResponseThreadPoolRejectedin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
isResponseRejected
public boolean isResponseRejected()
- Specified by:
isResponseRejectedin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getExecutionEvents
public List<com.netflix.hystrix.HystrixEventType> getExecutionEvents()
- Specified by:
getExecutionEventsin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getNumberEmissions
public int getNumberEmissions()
- Specified by:
getNumberEmissionsin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getNumberFallbackEmissions
public int getNumberFallbackEmissions()
- Specified by:
getNumberFallbackEmissionsin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getNumberCollapsed
public int getNumberCollapsed()
- Specified by:
getNumberCollapsedin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getOriginatingCollapserKey
public com.netflix.hystrix.HystrixCollapserKey getOriginatingCollapserKey()
- Specified by:
getOriginatingCollapserKeyin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getExecutionTimeInMilliseconds
public int getExecutionTimeInMilliseconds()
- Specified by:
getExecutionTimeInMillisecondsin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getCommandRunStartTimeInNanos
public long getCommandRunStartTimeInNanos()
- Specified by:
getCommandRunStartTimeInNanosin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
getEventCounts
public com.netflix.hystrix.ExecutionResult.EventCounts getEventCounts()
- Specified by:
getEventCountsin interfacecom.netflix.hystrix.HystrixInvokableInfo<R extends Object>
-
-