com.netflix.hystrix.HystrixInvokable Java Examples
The following examples show how to use
com.netflix.hystrix.HystrixInvokable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RegisterCommandExcutionHook.java From jframework with Apache License 2.0 | 6 votes |
public RegisterCommandExcutionHook() { HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); HystrixConcurrencyStrategy concurrencyStrategy = HystrixPlugins.getInstance().getConcurrencyStrategy(); HystrixMetricsPublisher hystrixMetricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerMetricsPublisher(hystrixMetricsPublisher); HystrixPlugins.getInstance().registerConcurrencyStrategy(concurrencyStrategy); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); HystrixPlugins.getInstance().registerCommandExecutionHook(new HystrixCommandExecutionHook() { @Override public <T> void onFallbackStart(HystrixInvokable<T> commandInstance) { HystrixCommand hystrixCommand = (HystrixCommand) commandInstance; String commandKey = hystrixCommand.getCommandKey().toString(); log.error("Hystrix: {} 接口开始降级", commandKey); super.onFallbackStart(commandInstance); } }); }
Example #2
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 5 votes |
@Override public <T> void onStart(HystrixInvokable<T> commandInstance) { if (!(commandInstance instanceof EnhancedInstance)) { actual.onStart(commandInstance); return; } EnhancedInstance enhancedInstance = (EnhancedInstance) commandInstance; EnhanceRequireObjectCache enhanceRequireObjectCache = (EnhanceRequireObjectCache) enhancedInstance.getSkyWalkingDynamicField(); if (ContextManager.isActive()) { enhanceRequireObjectCache.setContextSnapshot(ContextManager.capture()); } actual.onStart(commandInstance); }
Example #3
Source File: ExceptionLoggingCommandHook.java From tenacity with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public <T> Exception onExecutionError(HystrixInvokable<T> commandInstance, Exception exception) { for (ExceptionLogger<? extends Exception> logger: exceptionLoggers) { if (logger.canHandleException(exception) && isHystrixInvokableInfo(commandInstance)) { logger.log(exception, (HystrixInvokableInfo<T>)commandInstance); return exception; } } return exception; }
Example #4
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> T onEmit(HystrixInvokable<T> commandInstance, T value) { return actual.onEmit(commandInstance, value); }
Example #5
Source File: ExceptionLoggingCommandHook.java From tenacity with Apache License 2.0 | 4 votes |
private <T> boolean isHystrixInvokableInfo(HystrixInvokable<T> commandInstance) { return commandInstance instanceof HystrixInvokableInfo; }
Example #6
Source File: HystrixPluginsInterceptorTest.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onStart(HystrixInvokable<T> commandInstance) { delegate.onStart(commandInstance); }
Example #7
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onRunStart(HystrixInvokable<T> commandInstance) { actual.onRunStart(commandInstance); }
Example #8
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> T onRunSuccess(HystrixInvokable<T> commandInstance, T response) { return actual.onRunSuccess(commandInstance, response); }
Example #9
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> T onFallbackSuccess(HystrixInvokable<T> commandInstance, T fallbackResponse) { return actual.onFallbackSuccess(commandInstance, fallbackResponse); }
Example #10
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> T onComplete(HystrixInvokable<T> commandInstance, T response) { return actual.onComplete(commandInstance, response); }
Example #11
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onThreadStart(HystrixInvokable<T> commandInstance) { actual.onThreadStart(commandInstance); }
Example #12
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onThreadComplete(HystrixInvokable<T> commandInstance) { actual.onThreadComplete(commandInstance); }
Example #13
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onCacheHit(HystrixInvokable<T> commandInstance) { actual.onCacheHit(commandInstance); }
Example #14
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> T onFallbackEmit(HystrixInvokable<T> commandInstance, T value) { return actual.onFallbackEmit(commandInstance, value); }
Example #15
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> T onExecutionEmit(HystrixInvokable<T> commandInstance, T value) { return actual.onExecutionEmit(commandInstance, value); }
Example #16
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onSuccess(HystrixInvokable<T> commandInstance) { actual.onSuccess(commandInstance); }
Example #17
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> Exception onError(HystrixInvokable<T> commandInstance, HystrixRuntimeException.FailureType failureType, Exception e) { return actual.onError(commandInstance, failureType, e); }
Example #18
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> Exception onRunError(HystrixInvokable<T> commandInstance, Exception e) { return actual.onRunError(commandInstance, e); }
Example #19
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onFallbackSuccess(HystrixInvokable<T> commandInstance) { actual.onFallbackSuccess(commandInstance); }
Example #20
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> Exception onFallbackError(HystrixInvokable<T> commandInstance, Exception e) { return actual.onFallbackError(commandInstance, e); }
Example #21
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onFallbackStart(HystrixInvokable<T> commandInstance) { actual.onFallbackStart(commandInstance); }
Example #22
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onExecutionSuccess(HystrixInvokable<T> commandInstance) { actual.onExecutionSuccess(commandInstance); }
Example #23
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> Exception onExecutionError(HystrixInvokable<T> commandInstance, Exception e) { return actual.onExecutionError(commandInstance, e); }
Example #24
Source File: SWExecutionHookWrapper.java From skywalking with Apache License 2.0 | 4 votes |
@Override public <T> void onExecutionStart(HystrixInvokable<T> commandInstance) { actual.onExecutionStart(commandInstance); }
Example #25
Source File: BizkeeperHandler.java From servicecomb-java-chassis with Apache License 2.0 | 4 votes |
@Override public <T> Exception onExecutionError(HystrixInvokable<T> commandInstance, Exception e) { LOG.warn("bizkeeper execution error, info={}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); return e; //by default, just pass through }