Java Code Examples for com.netflix.hystrix.strategy.HystrixPlugins#reset()
The following examples show how to use
com.netflix.hystrix.strategy.HystrixPlugins#reset() .
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: MicrometerMetricsPublisherCommandTest.java From micrometer with Apache License 2.0 | 7 votes |
@Test void openCircuit() { HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerMetricsPublisher(new MicrometerMetricsPublisher(registry, metricsPublisher)); HystrixCommandKey key = HystrixCommandKey.Factory.asKey("MicrometerCOMMAND-B"); propertiesSetter.withCircuitBreakerForceOpen(true); new SuccessCommand(key).execute(); new SuccessCommand(key).execute(); new TimeoutCommand(key).execute(); new FailureCommand(key).execute(); new FailureCommand(key).execute(); new SuccessCommand(key).execute(); Iterable<Tag> tags = Tags.of("group", groupKey.name(), "key", key.name()); assertExecutionMetric(tags, HystrixEventType.SHORT_CIRCUITED, 6.0); assertExecutionMetric(tags, HystrixEventType.SUCCESS, 0.0); assertExecutionMetric(tags, HystrixEventType.TIMEOUT, 0.0); assertExecutionMetric(tags, HystrixEventType.FAILURE, 0.0); assertThat(registry.get("hystrix.circuit.breaker.open").tags(tags).gauge().value()).isEqualTo(1.0); }
Example 2
Source File: HystrixPluginsInterceptorTest.java From skywalking with Apache License 2.0 | 6 votes |
@Test public void testInterceptorWithCustomHystrixCommandExecutionHook() throws Throwable { Object wrapperResult = getCommandExecutionHookByInterceptor(); assertTrue(wrapperResult instanceof SWExecutionHookWrapper); assertSame(HystrixPlugins.getInstance().getCommandExecutionHook(), wrapperResult); // register custom HystrixCommandExecutionHook HystrixCommandExecutionHook delegate = getCommandExecutionHookByInterceptor(); HystrixCommandExecutionHook customCommandExecutionHook = new CustomHystrixCommandExecutionHook(delegate); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerCommandExecutionHook(customCommandExecutionHook); // custom HystrixCommandExecutionHook can be consumed wrapperResult = getCommandExecutionHookByInterceptor(); assertSame(customCommandExecutionHook, wrapperResult); assertSame(HystrixPlugins.getInstance().getCommandExecutionHook(), wrapperResult); }
Example 3
Source File: PreservesExecutionContextHystrixStrategy.java From spring-cloud-ribbon-extensions with Apache License 2.0 | 6 votes |
/** * registers the {@link ExecutionContextAwareHystrixStrategy} */ public static void init() { // keeps references of existing Hystrix plugins. HystrixConcurrencyStrategy existingConcurrencyStrategy = HystrixPlugins.getInstance().getConcurrencyStrategy(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook(); // reset the Hystrix plugin HystrixPlugins.reset(); // configure the plugin HystrixPlugins.getInstance().registerConcurrencyStrategy(new ExecutionContextAwareHystrixStrategy(existingConcurrencyStrategy)); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook); log.info("Context propagation enabled for Hystrix."); }
Example 4
Source File: ThreadLocalConfiguration.java From spring-microservices-in-action with Apache License 2.0 | 6 votes |
@PostConstruct public void init() { // Keeps references of existing Hystrix plugins. HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook(); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerConcurrencyStrategy(new ThreadLocalAwareStrategy(existingConcurrencyStrategy)); // Register your customized strategy ({@code ThreadLocalAwareStrategy}) HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook); }
Example 5
Source File: HystrixPluginsInterceptorTest.java From skywalking with Apache License 2.0 | 6 votes |
@Before public void setUp() { hystrixPluginsInterceptor = new HystrixPluginsInterceptor(); enhancedInstance = new EnhancedInstance() { private SWHystrixPluginsWrapperCache cache; @Override public Object getSkyWalkingDynamicField() { return cache; } @Override public void setSkyWalkingDynamicField(Object cache) { this.cache = (SWHystrixPluginsWrapperCache) cache; } }; HystrixPlugins.reset(); }
Example 6
Source File: GrayHystrixContextConcurrencyStrategy.java From spring-cloud-gray with Apache License 2.0 | 6 votes |
public GrayHystrixContextConcurrencyStrategy() { this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); if (this.delegate instanceof GrayHystrixContextConcurrencyStrategy) { return; } // Keeps references of existing Hystrix plugins. HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); HystrixPlugins.reset(); // Registers existing plugins excepts the Concurrent Strategy plugin. HystrixPlugins.getInstance().registerConcurrencyStrategy(this); HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); }
Example 7
Source File: SofaTracerHystrixConcurrencyStrategy.java From sofa-tracer with Apache License 2.0 | 6 votes |
public SofaTracerHystrixConcurrencyStrategy() { try { this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); if (this.delegate instanceof SofaTracerHystrixConcurrencyStrategy) { // Welcome to singleton hell... return; } HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance() .getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance() .getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance() .getPropertiesStrategy(); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerConcurrencyStrategy(this); HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); } catch (Exception ex) { SelfLog.error("Failed to register Sleuth Hystrix Concurrency Strategy", ex); } }
Example 8
Source File: MultiConfigs.java From astrix with Apache License 2.0 | 6 votes |
private static void registerWithHystrix() { final HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier(); final HystrixConcurrencyStrategy concurrencyStrategy = HystrixPlugins.getInstance().getConcurrencyStrategy(); final HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); final HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); final HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook(); HystrixPlugins.reset(); reRegister(eventNotifier, multiEventNotifierDispatcher, notifier -> HystrixPlugins.getInstance().registerEventNotifier(notifier)); reRegister(concurrencyStrategy, multiConcurrencyStrategyDispatcher, strategy -> HystrixPlugins.getInstance().registerConcurrencyStrategy(strategy)); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); reRegister(propertiesStrategy, multiPropertiesStrategyDispatcher, strategy -> HystrixPlugins.getInstance().registerPropertiesStrategy(strategy)); HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook); LOGGER.info(MultiPropertiesStrategyDispatcher.class.getName() + " registered with Hystrix!"); }
Example 9
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 10
Source File: TestProviderBizkeeperHandler.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void testCreateBizkeeperCommand() { HystrixPlugins.reset(); ProviderBizkeeperHanlder providerBizkeeperHanlder = new ProviderBizkeeperHanlder(); Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); CommandKey.toHystrixCommandGroupKey("groupname", invocation); CommandKey.toHystrixCommandKey("groupname", invocation); BizkeeperCommand command = providerBizkeeperHanlder.createBizkeeperCommand(invocation); Assert.assertNotNull(command); }
Example 11
Source File: RequestAttributeHystrixConcurrencyStrategy.java From spring-cloud-yes with Apache License 2.0 | 5 votes |
public RequestAttributeHystrixConcurrencyStrategy() { try { this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); if (this.delegate instanceof RequestAttributeHystrixConcurrencyStrategy) { // Welcome to singleton hell... return; } HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins .getInstance().getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance() .getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance() .getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance() .getPropertiesStrategy(); this.logCurrentStateOfHystrixPlugins(eventNotifier, metricsPublisher, propertiesStrategy); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerConcurrencyStrategy(this); HystrixPlugins.getInstance() .registerCommandExecutionHook(commandExecutionHook); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); } catch (Exception e) { log.error("Failed to register Sleuth Hystrix Concurrency Strategy", e); } }
Example 12
Source File: FeignHystrixConcurrencyStrategy.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
public FeignHystrixConcurrencyStrategy() { try { this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); if (this.delegate instanceof FeignHystrixConcurrencyStrategy) { // Welcome to singleton hell... return; } HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); this.logCurrentStateOfHystrixPlugins(eventNotifier, metricsPublisher, propertiesStrategy); HystrixPlugins.reset(); HystrixPlugins instance = HystrixPlugins.getInstance(); instance.registerConcurrencyStrategy(this); instance.registerCommandExecutionHook(commandExecutionHook); instance.registerEventNotifier(eventNotifier); instance.registerMetricsPublisher(metricsPublisher); instance.registerPropertiesStrategy(propertiesStrategy); } catch (Exception e) { log.error("Failed to register Sleuth Hystrix Concurrency Strategy", e); } }
Example 13
Source File: RequestAttributeHystrixConcurrencyStrategy.java From Taroco with Apache License 2.0 | 5 votes |
public RequestAttributeHystrixConcurrencyStrategy() { try { this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); if (this.delegate instanceof RequestAttributeHystrixConcurrencyStrategy) { // Welcome to singleton hell... return; } HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins .getInstance().getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance() .getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance() .getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance() .getPropertiesStrategy(); this.logCurrentStateOfHystrixPlugins(eventNotifier, metricsPublisher, propertiesStrategy); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerConcurrencyStrategy(this); HystrixPlugins.getInstance() .registerCommandExecutionHook(commandExecutionHook); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); } catch (Exception e) { log.error("Failed to register RequestAttributes Hystrix Concurrency Strategy", e); } }
Example 14
Source File: FeignHystrixConcurrencyStrategy.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
public FeignHystrixConcurrencyStrategy() { try { this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); if (this.delegate instanceof FeignHystrixConcurrencyStrategy) { // Welcome to singleton hell... return; } HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); this.logCurrentStateOfHystrixPlugins(eventNotifier, metricsPublisher, propertiesStrategy); HystrixPlugins.reset(); HystrixPlugins instance = HystrixPlugins.getInstance(); instance.registerConcurrencyStrategy(this); instance.registerCommandExecutionHook(commandExecutionHook); instance.registerEventNotifier(eventNotifier); instance.registerMetricsPublisher(metricsPublisher); instance.registerPropertiesStrategy(propertiesStrategy); } catch (Exception e) { log.error("Failed to register Sleuth Hystrix Concurrency Strategy", e); } }
Example 15
Source File: TestConsumerBizkeeperHandler.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void testCreateBizkeeperCommand() { HystrixPlugins.reset(); ConsumerBizkeeperHandler consumerBizkeeperHandler = new ConsumerBizkeeperHandler(); Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); CommandKey.toHystrixCommandGroupKey("groupname", invocation); CommandKey.toHystrixCommandKey("groupname", invocation); BizkeeperCommand command = consumerBizkeeperHandler.createBizkeeperCommand(invocation); Assert.assertNotNull(command); }
Example 16
Source File: MicrometerMetricsPublisherCommandTest.java From micrometer with Apache License 2.0 | 5 votes |
@Test void cumulativeCounters() throws Exception { HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher(); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerMetricsPublisher(new MicrometerMetricsPublisher(registry, metricsPublisher)); HystrixCommandKey key = HystrixCommandKey.Factory.asKey("MicrometerCOMMAND-A"); for (int i = 0; i < 3; i++) { new SuccessCommand(key).execute(); new SuccessCommand(key).execute(); new SuccessCommand(key).execute(); Thread.sleep(10); new TimeoutCommand(key).execute(); new SuccessCommand(key).execute(); new FailureCommand(key).execute(); new FailureCommand(key).execute(); new SuccessCommand(key).execute(); new SuccessCommand(key).execute(); new SuccessCommand(key).execute(); Thread.sleep(10); new SuccessCommand(key).execute(); } Iterable<Tag> tags = Tags.of("group", "MicrometerGROUP", "key", "MicrometerCOMMAND-A"); assertExecutionMetric(tags, HystrixEventType.SUCCESS, 24.0); assertExecutionMetric(tags, HystrixEventType.TIMEOUT, 3.0); assertExecutionMetric(tags, HystrixEventType.FAILURE, 6.0); assertExecutionMetric(tags, HystrixEventType.SHORT_CIRCUITED, 0.0); assertThat(registry.get("hystrix.circuit.breaker.open").tags(tags).gauge().value()).isEqualTo(0.0); }
Example 17
Source File: HmilyHystrixConcurrencyStrategy.java From hmily with Apache License 2.0 | 5 votes |
public HmilyHystrixConcurrencyStrategy() { try { this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); if (this.delegate instanceof HmilyHystrixConcurrencyStrategy) { return; } HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins .getInstance().getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance() .getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance() .getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance() .getPropertiesStrategy(); LOGGER.debug("HystrixEventNotifier:{}, HystrixMetricsPublisher:{}, HystrixPropertiesStrategy:{}", eventNotifier, metricsPublisher, propertiesStrategy); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerConcurrencyStrategy(this); HystrixPlugins.getInstance() .registerCommandExecutionHook(commandExecutionHook); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); } catch (Exception e) { LOGGER.error("Failed to register Tracing Hystrix Concurrency Strategy", e); } }
Example 18
Source File: RaincatHystrixConcurrencyStrategy.java From Raincat with GNU Lesser General Public License v3.0 | 5 votes |
/** * Instantiates a new Raincat hystrix concurrency strategy. */ public RaincatHystrixConcurrencyStrategy() { try { this.delegate = HystrixPlugins.getInstance().getConcurrencyStrategy(); if (this.delegate instanceof RaincatHystrixConcurrencyStrategy) { return; } HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins .getInstance().getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance() .getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance() .getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance() .getPropertiesStrategy(); LOGGER.debug("HystrixEventNotifier:{}, HystrixMetricsPublisher:{}, HystrixPropertiesStrategy:{}", eventNotifier, metricsPublisher, propertiesStrategy); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerConcurrencyStrategy(this); HystrixPlugins.getInstance() .registerCommandExecutionHook(commandExecutionHook); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); } catch (Exception e) { LOGGER.error("Failed to register Tracing Hystrix Concurrency Strategy", e); } }
Example 19
Source File: HystrixFeignTracingTest.java From feign-opentracing with Apache License 2.0 | 4 votes |
@Override public void before() throws IOException { HystrixPlugins.reset(); TracingConcurrencyStrategy.register(mockTracer); super.before(); }
Example 20
Source File: HystrixServiceCombAutoConfiguration.java From servicecomb-pack with Apache License 2.0 | 4 votes |
@PostConstruct public void init() { try { if (CollectionUtils.isEmpty(hystrixCallableWrappers)) { log.info( "no hystrixCallableWrapper find ,ServiceCombConcurrencyStrategy ignore Configuration"); return; } HystrixConcurrencyStrategy concurrencyStrategy = detectRegisteredConcurrencyStrategy(); if (concurrencyStrategy instanceof ServiceCombConcurrencyStrategy) { log.info( "Current Hystrix plugins concurrencyStrategy is ServiceCombConcurrencyStrategy ignore Configuration"); return; } // Keeps references of existing Hystrix plugins. HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance() .getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance() .getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance() .getPropertiesStrategy(); HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance() .getCommandExecutionHook(); log.info("Current Hystrix plugins configuration is [" + "concurrencyStrategy [" + concurrencyStrategy + "]," + "eventNotifier [" + eventNotifier + "]," + "metricPublisher [" + metricsPublisher + "]," + "propertiesStrategy [" + propertiesStrategy + "]," + "]"); HystrixPlugins.reset(); // Registers existing plugins excepts the Concurrent Strategy plugin. HystrixPlugins.getInstance().registerConcurrencyStrategy( new ServiceCombConcurrencyStrategy(concurrencyStrategy, hystrixCallableWrappers)); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy); HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook); log.info("Succeeded to register ServiceComb Hystrix Concurrency Strategy"); } catch (Exception e) { log.error("Failed to register ServiceComb Hystrix Concurrency Strategy", e); } }