Java 类com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck 实例源码

项目:lemon    文件:MetricsHelper.java   
@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());
}
项目:moneta    文件:MonetaConfiguration.java   
/**
 * 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;
}
项目:werval    文件:MetricsPlugin.java   
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() );
    }
}
项目:cdk    文件:RegisterJVMMetricsBuilder.java   
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());
}
项目:dr-elephant    文件:MetricsController.java   
/**
 * 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());
}
项目:haven-platform    文件:HealthCheckConfiguration.java   
@Autowired
public void setHealthCheckRegistry(HealthCheckRegistry registry) {
    registry.register(ThreadDeadlockHealthCheck.class.getName(), new ThreadDeadlockHealthCheck());
}
项目:nexus-public    文件:DeadlockHealthCheckProvider.java   
public HealthCheck get() {
  return new ThreadDeadlockHealthCheck();
}
项目:modules    文件:HealthCheckRegistryInitializer.java   
@PostConstruct
public void init() {
    ThreadDeadlockHealthCheck threadDeadlockHealthCheck = new ThreadDeadlockHealthCheck();
    healthCheckRegistry.register("threadDeadlockHealthCheck", threadDeadlockHealthCheck);
}
项目:grails-lightweight-deploy    文件:Launcher.java   
protected void configureHealthChecks() {
    HealthCheckRegistry healthCheckRegistry = getHealthCheckRegistry();
    healthCheckRegistry.register("threadDeadlock", new ThreadDeadlockHealthCheck());
}