com.netflix.hystrix.Hystrix.reset()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中com.netflix.hystrix.Hystrix.reset()方法的一些代码示例,展示了Hystrix.reset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hystrix.reset()方法的具体详情如下:
包路径:com.netflix.hystrix.Hystrix
类名称:Hystrix
方法名:reset

Hystrix.reset介绍

[英]Reset state and release resources in use (such as thread-pools).

NOTE: This can result in race conditions if HystrixCommands are concurrently being executed.
[中]重置状态并释放正在使用的资源(如线程池)。
注意:如果同时执行HYSTRIxCommand,这可能会导致争用条件。

代码示例

代码示例来源:origin: PipelineAI/pipeline

@Override
protected void before() {
  this.context = HystrixRequestContext.initializeContext();
  Hystrix.reset();
}

代码示例来源:origin: PipelineAI/pipeline

@Before
public void setup() {
  Hystrix.reset();
}

代码示例来源:origin: PipelineAI/pipeline

@Before
public void reset() {
  Hystrix.reset();
}

代码示例来源:origin: PipelineAI/pipeline

@Before
public void init() {
  HystrixCommandMetrics.reset();
  Hystrix.reset();
}

代码示例来源:origin: PipelineAI/pipeline

Hystrix.reset();

代码示例来源:origin: PipelineAI/pipeline

@Before
public void init() {
  for (HystrixCommandMetrics metricsInstance: HystrixCommandMetrics.getInstances()) {
    metricsInstance.resetStream();
  }
  HystrixCommandMetrics.reset();
  HystrixCircuitBreaker.Factory.reset();
  Hystrix.reset();
}

代码示例来源:origin: PipelineAI/pipeline

@Ignore
@Test
public void testSuccessClosesCircuitWhenBusy() throws InterruptedException {
  HystrixPlugins.getInstance().registerCommandExecutionHook(new MyHystrixCommandExecutionHook());
  try {
    performLoad(200, 0, 40);
    performLoad(250, 100, 40);
    performLoad(600, 0, 40);
  } finally {
    Hystrix.reset();
  }
}

代码示例来源:origin: PipelineAI/pipeline

@Test
public void testResetCommandProperties() {
  HystrixCommand<Boolean> cmd1 = new ResettableCommand(100, 1, 10);
  assertEquals(100L, (long) cmd1.getProperties().executionTimeoutInMilliseconds().get());
  assertEquals(1L, (long) cmd1.getProperties().executionIsolationSemaphoreMaxConcurrentRequests().get());
  //assertEquals(10L, (long) cmd1.threadPool.getExecutor()..getCorePoolSize());
  Hystrix.reset();
  HystrixCommand<Boolean> cmd2 = new ResettableCommand(700, 2, 40);
  assertEquals(700L, (long) cmd2.getProperties().executionTimeoutInMilliseconds().get());
  assertEquals(2L, (long) cmd2.getProperties().executionIsolationSemaphoreMaxConcurrentRequests().get());
  //assertEquals(40L, (long) cmd2.threadPool.getExecutor().getCorePoolSize());
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-netflix-hystrix

@Override
public void destroy() throws Exception {
  // Just call Hystrix to reset thread pool etc.
  Hystrix.reset();
}

代码示例来源:origin: io.smallrye/smallrye-fault-tolerance

@PreDestroy
  void onShutdown() {
    LOGGER.info("### Reset Hystrix ###");
    Hystrix.reset(1, TimeUnit.SECONDS);
  }
}

代码示例来源:origin: com.sap.cloud.s4hana.frameworks/hystrix

/**
 * Safely shuts down Hystrix if not yet shut down. Invocation is synchronized on this class.
 */
public void shutdown()
{
  synchronized( HystrixBootstrapListener.class ) {
    if( isInitialized ) {
      if( logger.isInfoEnabled() ) {
        logger.info("Shutting down Hystrix.");
      }
      Hystrix.reset();
      isInitialized = false;
    } else {
      if( logger.isInfoEnabled() ) {
        logger.info("Hystrix already shut down.");
      }
    }
  }
}

代码示例来源:origin: AvanzaBank/astrix

private static void initHystrixPlugins() {
  try {
    registerDispatcherStrategies();
  } catch (Exception e) {
    log.warn("Failed to init Hystrix with custom Astrix strategies. Hystrix configuration will be reset and one more registreation attempt will be performed", e);
    Hystrix.reset();
    registerDispatcherStrategies();
  }
}

代码示例来源:origin: com.yammer.tenacity/tenacity-core

@Override
  public void stop() throws Exception {
    Hystrix.reset(shutdownGracePeriod.getQuantity(), shutdownGracePeriod.getUnit());
  }
}

代码示例来源:origin: yammer/tenacity

public void teardown() {
  Hystrix.reset(1, TimeUnit.SECONDS);
  ConfigurationManager.getConfigInstance().clear();
}

代码示例来源:origin: yammer/tenacity

@Override
  public void stop() throws Exception {
    Hystrix.reset(shutdownGracePeriod.getQuantity(), shutdownGracePeriod.getUnit());
  }
}

代码示例来源:origin: yammer/tenacity

private void setup() {
  resetStreams();
  Hystrix.reset();
  final AbstractConfiguration configuration = ConfigurationManager.getConfigInstance();
  configuration.setProperty("hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds", "100");
}

代码示例来源:origin: com.redhat.lightblue/lightblue-core-hystrix

Hystrix.reset();
HystrixPlugins.reset();

相关文章