本文整理汇总了Java中com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck类的典型用法代码示例。如果您正苦于以下问题:Java ThreadDeadlockHealthCheck类的具体用法?Java ThreadDeadlockHealthCheck怎么用?Java ThreadDeadlockHealthCheck使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ThreadDeadlockHealthCheck类属于com.codahale.metrics.health.jvm包,在下文中一共展示了ThreadDeadlockHealthCheck类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
@PostConstruct
public void init() {
/*
* consoleReporter = ConsoleReporter.forRegistry(metricRegistry) .convertRatesTo(TimeUnit.SECONDS)
* .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); consoleReporter.start(1, TimeUnit.SECONDS);
*/
GarbageCollectorMetricSet gc = new GarbageCollectorMetricSet();
// FileDescriptorRatioGauge fd = new FileDescriptorRatioGauge();
MemoryUsageGaugeSet mu = new MemoryUsageGaugeSet();
// ThreadDeadlockDetector td = new ThreadDeadlockDetector();
// ThreadDump t = new ThreadDump();
ThreadStatesGaugeSet ts = new ThreadStatesGaugeSet();
metricRegistry.register("GarbageCollector", gc);
// registry.register(FileDescriptorRatioGauge.class.getName(), fd);
metricRegistry.register("MemoryUsage", mu);
// registry.register(ThreadDeadlockDetector.class.getName(), td);
// registry.registerAll(t);
metricRegistry.register("ThreadStates", ts);
healthCheckRegistry.register("threadDeadlock",
new ThreadDeadlockHealthCheck());
}
示例2: init
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
/**
* Will initialize Moneta given a configuration. This <b>must</b> be executed before use.
* @param config XML configuration
*/
protected final void init(XMLConfiguration config) {
initDataSources(config);
initTopics(config);
healthChecks.put("Deadlock", new ThreadDeadlockHealthCheck());
initRun = true;
}
示例3: registerHealthChecks
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
private void registerHealthChecks( Application application, HealthCheckRegistry healthChecks )
{
Config config = application.config().atKey( "metrics" );
// JVM HealthChecks
if( config.bool( "healthchecks.deadlocks.enabled" ) )
{
healthChecks.register( "jvm.deadlocks", new ThreadDeadlockHealthCheck() );
}
}
示例4: RegisterJVMMetrics
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
public RegisterJVMMetrics(CommandBuilder builder, Config config, Command parent,
Command child, final MorphlineContext context) {
super(builder, config, parent, child, context);
validateArguments();
MetricRegistry registry = context.getMetricRegistry();
BufferPoolMetricSet bufferPoolMetrics = new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer());
registerAll("jvm.buffers", bufferPoolMetrics, registry);
registerAll("jvm.gc", new GarbageCollectorMetricSet(), registry);
registerAll("jvm.memory", new MemoryUsageGaugeSet(), registry);
registerAll("jvm.threads", new ThreadStatesGaugeSet(), registry);
register("jvm.fileDescriptorCountRatio", new FileDescriptorRatioGauge(), registry);
context.getHealthCheckRegistry().register("deadlocks", new ThreadDeadlockHealthCheck());
}
示例5: init
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
/**
* Initializer method for the metrics registry. Call this method before registering
* new metrics with the registry.
*/
public static void init() {
// Metrics registries will be initialized only if enabled
if(!Configuration.root().getBoolean("metrics", false)) {
LOGGER.debug("Metrics not enabled in the conf file.");
return;
}
// Metrics & healthcheck registries will be initialized only once
if(_metricRegistry != null) {
LOGGER.debug("Metric registries already initialized.");
return;
}
_metricRegistry = new MetricRegistry();
String className = AnalyticJob.class.getSimpleName();
_skippedJobs = _metricRegistry.meter(name(className, "skippedJobs", "count"));
_processedJobs = _metricRegistry.meter(name(className, "processedJobs", "count"));
_jobProcessingTime = _metricRegistry.histogram(name(className, "jobProcessingTime", "ms"));
_metricRegistry.register(name(className, "jobQueue", "size"), new Gauge<Integer>() {
@Override
public Integer getValue() {
return _queueSize;
}
});
_metricRegistry.register(name(className, "lastDayJobs", "count"), new Gauge<Integer>() {
private static final long DAY = 24 * 60 * 60 * 1000;
private static final long UPDATE_DELAY = 60 * 1000;
private long _lastUpdate = 0;
private int _count = -1;
@Override
public Integer getValue() {
long now = System.currentTimeMillis();
if (now - _lastUpdate > UPDATE_DELAY) {
_count = AppResult.find.where()
.gt(AppResult.TABLE.FINISH_TIME, now - DAY)
.findRowCount();
_lastUpdate = now;
}
return _count;
}
});
_metricRegistry.register(name(className, "retryQueue", "size"), new Gauge<Integer>() {
@Override
public Integer getValue() {
return _retryQueueSize;
}
});
_metricRegistry.registerAll(new CustomGarbageCollectorMetricSet());
_metricRegistry.registerAll(new MemoryUsageGaugeSet());
JmxReporter.forRegistry(_metricRegistry).build().start();
_healthCheckRegistry = new HealthCheckRegistry();
_healthCheckRegistry.register("ThreadDeadlockHealthCheck",
new ThreadDeadlockHealthCheck());
}
示例6: setHealthCheckRegistry
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
@Autowired
public void setHealthCheckRegistry(HealthCheckRegistry registry) {
registry.register(ThreadDeadlockHealthCheck.class.getName(), new ThreadDeadlockHealthCheck());
}
示例7: get
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
public HealthCheck get() {
return new ThreadDeadlockHealthCheck();
}
示例8: init
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
@PostConstruct
public void init() {
ThreadDeadlockHealthCheck threadDeadlockHealthCheck = new ThreadDeadlockHealthCheck();
healthCheckRegistry.register("threadDeadlockHealthCheck", threadDeadlockHealthCheck);
}
示例9: configureHealthChecks
import com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck; //导入依赖的package包/类
protected void configureHealthChecks() {
HealthCheckRegistry healthCheckRegistry = getHealthCheckRegistry();
healthCheckRegistry.register("threadDeadlock", new ThreadDeadlockHealthCheck());
}