Skip to content

Commit ff787cb

Browse files
authored
use registry close for lifecycle with spectator 1.10.1 (#650)
Spectator 1.10.0 ties the GC logger lifecycle to the registry via GcLogger.monitor(registry), and AtlasRegistry/SidecarRegistry now flush and release resources (including PolledMeter background tasks) on close(). Update the registry services to use the new APIs instead of managing the GcLogger and registry stop by hand. Bump to 1.10.1 to pick up the IDE warning fixes.
1 parent 09458b5 commit ff787cb

3 files changed

Lines changed: 5 additions & 10 deletions

File tree

‎iep-spring-atlas/src/main/java/com/netflix/iep/atlas/AtlasRegistryService.java‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ private static Config defaultConfig() {
5858
private final Config config;
5959

6060
private AtlasRegistry registry;
61-
private GcLogger gcLogger;
6261

6362
AtlasRegistryService(Clock clock, Config config) {
6463
this.clock = (clock == null) ? Clock.SYSTEM : clock;
@@ -87,9 +86,8 @@ Registry getRegistry() {
8786
Spectator.globalRegistry().add(registry);
8887

8988
// Enable GC logger
90-
gcLogger = new GcLogger();
9189
if (cfg.getBoolean("atlas.collection.gc")) {
92-
gcLogger.start(null);
90+
GcLogger.monitor(registry);
9391
}
9492

9593
// Enable JVM data collection
@@ -99,8 +97,7 @@ Registry getRegistry() {
9997
}
10098

10199
@Override protected void stopImpl() throws Exception {
102-
gcLogger.stop();
103-
registry.stop();
100+
registry.close();
104101
}
105102

106103
private static class TypesafeAtlasConfig implements AtlasConfig {

‎iep-spring-spectatord/src/main/java/com/netflix/iep/spectatord/SidecarRegistryService.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ private static Config defaultConfig() {
5050
private final Config config;
5151

5252
private SidecarRegistry registry;
53-
private GcLogger gcLogger;
5453

5554
SidecarRegistryService(Config config) {
5655
this.config = (config == null) ? defaultConfig() : config;
@@ -77,9 +76,8 @@ Registry getRegistry() {
7776
Spectator.globalRegistry().add(registry);
7877

7978
// Enable GC logger
80-
gcLogger = new GcLogger();
8179
if (cfg.getBoolean("sidecar.collection.gc")) {
82-
gcLogger.start(null);
80+
GcLogger.monitor(registry);
8381
}
8482

8583
// Enable JVM data collection
@@ -89,7 +87,7 @@ Registry getRegistry() {
8987
}
9088

9189
@Override protected void stopImpl() throws Exception {
92-
gcLogger.stop();
90+
registry.close();
9391
}
9492

9593
private static class TypesafeConfig implements SidecarConfig {

‎project/Dependencies.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Dependencies {
77
val jackson = "3.1.4"
88
val scala = "2.12.20"
99
val slf4j = "2.0.18"
10-
val spectator = "1.9.7"
10+
val spectator = "1.10.1"
1111
val spring = "7.0.7"
1212
val springBoot = "4.0.6"
1313
}

0 commit comments

Comments
 (0)