Skip to content

Commit 9a7a0c5

Browse files
committed
8355914: [17u] Backout backport of JDK-8320687
1 parent c269609 commit 9a7a0c5

File tree

2 files changed

+10
-96
lines changed

2 files changed

+10
-96
lines changed

src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
5050
* @see HostListener
5151
*/
5252
public abstract class MonitoredHost {
53-
private static final Map<HostIdentifier, MonitoredHost> monitoredHosts =
53+
private static Map<HostIdentifier, MonitoredHost> monitoredHosts =
5454
new HashMap<HostIdentifier, MonitoredHost>();
5555

5656
/*
@@ -133,6 +133,13 @@ public static MonitoredHost getMonitoredHost(VmIdentifier vmid)
133133
return getMonitoredHost(hostId);
134134
}
135135

136+
137+
/*
138+
* Load the MonitoredHostServices
139+
*/
140+
private static ServiceLoader<MonitoredHostService> monitoredHostServiceLoader =
141+
ServiceLoader.load(MonitoredHostService.class, MonitoredHostService.class.getClassLoader());
142+
136143
/**
137144
* Factory method to construct a MonitoredHost instance to manage the
138145
* connection to the host indicated by {@code hostId}.
@@ -160,12 +167,9 @@ public static MonitoredHost getMonitoredHost(HostIdentifier hostId)
160167

161168
hostId = resolveHostId(hostId);
162169

163-
ServiceLoader<MonitoredHostService> services = ServiceLoader.load(
164-
MonitoredHostService.class, MonitoredHostService.class.getClassLoader());
165-
for (MonitoredHostService mhs : services) {
170+
for (MonitoredHostService mhs : monitoredHostServiceLoader) {
166171
if (mhs.getScheme().equals(hostId.getScheme())) {
167172
mh = mhs.getMonitoredHost(hostId);
168-
break;
169173
}
170174
}
171175

test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)