mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 20:53:14 +08:00
Fix ray java worker metric registry indentation (#9780)
This commit is contained in:
@@ -11,9 +11,8 @@ public class MetricConfig {
|
||||
private static final int DEFAULT_THREAD_POLL_SIZE = 1;
|
||||
private static final long DEFAULT_SHUTDOWN_WAIT_TIME_MS = 3000L;
|
||||
|
||||
public static final MetricConfig DEFAULT_CONFIG =
|
||||
new MetricConfig(DEFAULT_TIME_INTERVAL_MS, DEFAULT_THREAD_POLL_SIZE,
|
||||
DEFAULT_SHUTDOWN_WAIT_TIME_MS);
|
||||
public static final MetricConfig DEFAULT_CONFIG = new MetricConfig(DEFAULT_TIME_INTERVAL_MS,
|
||||
DEFAULT_THREAD_POLL_SIZE, DEFAULT_SHUTDOWN_WAIT_TIME_MS);
|
||||
|
||||
private final long timeIntervalMs;
|
||||
private final int threadPoolSize;
|
||||
|
||||
@@ -33,9 +33,9 @@ public class MetricRegistry {
|
||||
if (!isRunning) {
|
||||
this.metricConfig = metricConfig;
|
||||
scheduledExecutorService = new ScheduledThreadPoolExecutor(metricConfig.threadPoolSize(),
|
||||
new ThreadFactoryBuilder().setNameFormat("metric-registry-%d").build());
|
||||
new ThreadFactoryBuilder().setNameFormat("metric-registry-%d").build());
|
||||
scheduledExecutorService.scheduleAtFixedRate(this::update, metricConfig.timeIntervalMs(),
|
||||
metricConfig.timeIntervalMs(), TimeUnit.MILLISECONDS);
|
||||
metricConfig.timeIntervalMs(), TimeUnit.MILLISECONDS);
|
||||
isRunning = true;
|
||||
LOG.info("Finished startup metric registry, metricConfig is {}.", metricConfig);
|
||||
}
|
||||
@@ -47,15 +47,15 @@ public class MetricRegistry {
|
||||
if (isRunning && scheduledExecutorService != null) {
|
||||
try {
|
||||
scheduledExecutorService.shutdownNow();
|
||||
if (!scheduledExecutorService
|
||||
.awaitTermination(metricConfig.shutdownWaitTimeMs(), TimeUnit.MILLISECONDS)) {
|
||||
if (!scheduledExecutorService.awaitTermination(metricConfig.shutdownWaitTimeMs(),
|
||||
TimeUnit.MILLISECONDS)) {
|
||||
LOG.warn("Metric registry did not shut down in {}ms time, so try to shut down again.",
|
||||
metricConfig.shutdownWaitTimeMs());
|
||||
metricConfig.shutdownWaitTimeMs());
|
||||
scheduledExecutorService.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
LOG.warn("Interrupted when shutting down metric registry, so try to shut down again.",
|
||||
e.getMessage(), e);
|
||||
e.getMessage(), e);
|
||||
scheduledExecutorService.shutdownNow();
|
||||
}
|
||||
if (scheduledExecutorService.isShutdown()) {
|
||||
|
||||
Reference in New Issue
Block a user