本文整理汇总了Java中com.netflix.hystrix.Hystrix.reset方法的典型用法代码示例。如果您正苦于以下问题:Java Hystrix.reset方法的具体用法?Java Hystrix.reset怎么用?Java Hystrix.reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.netflix.hystrix.Hystrix
的用法示例。
在下文中一共展示了Hystrix.reset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@Before
public void setUp() {
Hystrix.reset();
HystrixPlugins.reset();
HystrixRequestContext.initializeContext();
HystrixPlugins.getInstance().registerMetricsPublisher(notifier);
}
示例2: reset
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@After
public void reset() {
ConfigurationManager.getConfigInstance()
.setProperty("hystrix.command.default.circuitBreaker.forceOpen",
false);
Hystrix.reset();
}
示例3: initHystrixPlugins
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
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();
}
}
示例4: before
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@Before
public void before() throws InterruptedException {
Hystrix.reset();
context = new TestAstrixConfigurer().enableFaultTolerance(true)
.registerApiProvider(PingApi.class)
.set(AstrixBeanSettings.TIMEOUT, AstrixBeanKey.create(Ping.class), 250)
.set(AstrixBeanSettings.CORE_SIZE, AstrixBeanKey.create(Ping.class), 1)
.set(AstrixThreadPoolProperties.MAX_QUEUE_SIZE, AstrixBeanKey.create(Ping.class), -1) // NO QUEUE
.set("pingUri", DirectComponent.registerAndGetUri(Ping.class, pingServer))
.configure();
ping = context.getBean(Ping.class);
initMetrics(ping);
}
示例5: before
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@Before
public void before() throws InterruptedException {
Hystrix.reset();
context = new TestAstrixConfigurer().enableFaultTolerance(true)
.registerApiProvider(PingApi.class)
.set(AstrixBeanSettings.TIMEOUT, AstrixBeanKey.create(Ping.class), 25)
.set(AstrixBeanSettings.MAX_CONCURRENT_REQUESTS, AstrixBeanKey.create(Ping.class), 1)
.set("pingUri", DirectComponent.registerAndGetUri(Ping.class, pingServer))
.configure();
ping = context.getBean(Ping.class);
initMetrics(ping);
}
示例6: setup
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@Before
public void setup() throws InterruptedException {
Hystrix.reset();
counter.incrementAndGet();
astrixConfigurer.registerApiProvider(PingApiProvider.class);
astrixConfigurer.registerApiProvider(CorruptPingApiProvider.class);
astrixConfigurer.enableFaultTolerance(true);
context = (AstrixApplicationContext) astrixConfigurer.configure();
ping = context.getBean(Ping.class);
initMetrics(ping);
}
示例7: contextDestroyed
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
/**
* Notification that the servlet context is about to be shut down.
* @param event ServletContextEvent
*/
public void contextDestroyed(ServletContextEvent event) {
LOG.debug("HystrixWebListener - contextDestroyed");
LOG.debug("Invoke Hystrix.reset()");
Hystrix.reset();
LOG.debug("Completed Hystrix.reset()");
}
示例8: destroy
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@Override
public void destroy() throws Exception {
LOG.info("Shutting down Hystrix...");
// shutdown all thread pools; waiting a little time for shutdown
Hystrix.reset(1, TimeUnit.SECONDS);
LOG.info("Shut down Hystrix done.");
}
示例9: deactivate
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
/**
* Component deactivation callback which is used to reset Hystrix.
*/
@Deactivate
protected void deactivate() {
Hystrix.reset();
}
示例10: tearDown
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
Hystrix.reset();
}
示例11: before
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@Before
public void before() {
Hystrix.reset();
}
示例12: destroy
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@Override
public void destroy() {
super.destroy();
Hystrix.reset(5, TimeUnit.SECONDS);
wrappedServlet.destroy();
}
示例13: teardown
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@After
public void teardown() {
Hystrix.reset();
CollectorRegistry.defaultRegistry.clear();
}
示例14: teardown
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
@After
public void teardown() {
CollectorRegistry.defaultRegistry.clear();
Hystrix.reset();
}
示例15: doInitialize
import com.netflix.hystrix.Hystrix; //导入方法依赖的package包/类
private static synchronized void doInitialize(final Type... types) {
if (initialized) {
return;
}
// Fix Java 7 problem that initialized Hystrix/Servo before the it has been even called
Hystrix.reset();
HystrixPlugins.reset();
// register hystrix servo metrics publisher, required for collecting hystrix metrics
HystrixPlugins.getInstance().registerMetricsPublisher(HystrixServoMetricsPublisher.getInstance());
// if IllegalStateException is thrown it means there is a hytrix command being used prior to this setup.
// SEE: https://github.com/lightblue-platform/lightblue-rest/issues/58
// https://github.com/Netflix/Hystrix/issues/150
List<MetricObserver> observers = new ArrayList<>();
for (Type type : types) {
switch (type) {
case GRAPHITE:
registerGraphiteMetricObserver(observers, findVariable(ENV_GRAPHITE_PREFIX),
findVariable(ENV_GRAPHITE_HOSTNAME), findVariable(ENV_GRAPHITE_PORT));
break;
case STATSD:
registerStatsdMetricObserver(observers, findVariable(ENV_STATSD_PREFIX),
findVariable(ENV_STATSD_HOSTNAME), findVariable(ENV_STATSD_PORT));
break;
default:
throw new RuntimeException("Unsupported Type: " + type);
}
}
// start poll scheduler
PollScheduler.getInstance().start();
// create and register registery poller
PollRunnable registeryTask = new PollRunnable(new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL, observers);
PollScheduler.getInstance().addPoller(registeryTask, 5, TimeUnit.SECONDS);
// create and register jvm poller
PollRunnable jvmTask = new PollRunnable(new JvmMetricPoller(), BasicMetricFilter.MATCH_ALL, observers);
PollScheduler.getInstance().addPoller(jvmTask, 5, TimeUnit.SECONDS);
initialized = true;
LOGGER.debug("doInitialize() completed, initialized = " + initialized);
}