@Override public void onPassivate( Application application ) { requestTimers.values().forEach( t -> t.stop() ); requestTimers = null; reporters.forEach( r -> { if( r instanceof ScheduledReporter ) { ( (ScheduledReporter) r ).stop(); } else if( r instanceof JmxReporter ) { ( (JmxReporter) r ).stop(); } } ); reporters = null; api = null; eventRegistration.unregister(); eventRegistration = null; SharedMetricRegistries.clear(); SharedHealthCheckRegistries.clear(); }
@Override public Set<String> getHealthCheckNames(final String registryName) { checkArgument(isNotBlank(registryName)); if (!SharedHealthCheckRegistries.names().contains(registryName)) { return Collections.emptySet(); } return SharedHealthCheckRegistries.getOrCreate(registryName).getNames(); }
@Override public HealthCheck.Result runHealthCheck(final String registryName, final String healthCheckName) { checkArgument(isNotBlank(registryName)); checkArgument(isNotBlank(healthCheckName)); checkArgument(SharedHealthCheckRegistries.names().contains(registryName)); final HealthCheckRegistry registry = SharedHealthCheckRegistries.getOrCreate(registryName); checkArgument(registry.getNames().contains(healthCheckName)); final HealthCheck.Result result = registry.runHealthCheck(healthCheckName); logAppEvent(result, registryName, healthCheckName); return result; }
@Override public Set<String> getRegistryNames() { return SharedHealthCheckRegistries.names(); }
/** * Performs the following: * * <ol> * <li>initializes the metric registry * <li>initializes the healthcheck regsistry * </ol> * * @param vertx Vertx * @param context Context */ @Override public final void init(final Vertx vertx, final Context context) { super.init(vertx, context); this.metricRegistry = SharedMetricRegistries.getOrCreate(getRunRightFastVerticleId().toString()); this.healthCheckRegistry = SharedHealthCheckRegistries.getOrCreate(getRunRightFastVerticleId().toString()); this.instanceId = instanceSequence.incrementAndGet(); this.verticleInstanceId = new RunRightFastVerticleInstanceId(getRunRightFastVerticleId(), instanceId, context.deploymentID()); info.log("init", () -> lifeCycleMsg("initialized")); }