Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/management/RuntimeImpl.java
38827 views
1
/*
2
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.management;
27
28
import java.lang.management.RuntimeMXBean;
29
import java.lang.management.ManagementFactory;
30
31
import java.util.List;
32
import java.util.HashMap;
33
import java.util.Map;
34
import java.util.Set;
35
import java.util.Properties;
36
import javax.management.ObjectName;
37
38
/**
39
* Implementation class for the runtime subsystem.
40
* Standard and committed hotspot-specific metrics if any.
41
*
42
* ManagementFactory.getRuntimeMXBean() returns an instance
43
* of this class.
44
*/
45
class RuntimeImpl implements RuntimeMXBean {
46
47
private final VMManagement jvm;
48
private final long vmStartupTime;
49
50
/**
51
* Constructor of RuntimeImpl class.
52
*/
53
RuntimeImpl(VMManagement vm) {
54
this.jvm = vm;
55
this.vmStartupTime = jvm.getStartupTime();
56
}
57
58
public String getName() {
59
return jvm.getVmId();
60
}
61
62
public String getManagementSpecVersion() {
63
return jvm.getManagementVersion();
64
}
65
66
public String getVmName() {
67
return jvm.getVmName();
68
}
69
70
public String getVmVendor() {
71
return jvm.getVmVendor();
72
}
73
74
public String getVmVersion() {
75
return jvm.getVmVersion();
76
}
77
78
public String getSpecName() {
79
return jvm.getVmSpecName();
80
}
81
82
public String getSpecVendor() {
83
return jvm.getVmSpecVendor();
84
}
85
86
public String getSpecVersion() {
87
return jvm.getVmSpecVersion();
88
}
89
90
public String getClassPath() {
91
return jvm.getClassPath();
92
}
93
94
public String getLibraryPath() {
95
return jvm.getLibraryPath();
96
}
97
98
public String getBootClassPath() {
99
if (!isBootClassPathSupported()) {
100
throw new UnsupportedOperationException(
101
"Boot class path mechanism is not supported");
102
}
103
Util.checkMonitorAccess();
104
return jvm.getBootClassPath();
105
}
106
107
public List<String> getInputArguments() {
108
Util.checkMonitorAccess();
109
return jvm.getVmArguments();
110
}
111
112
public long getUptime() {
113
return jvm.getUptime();
114
}
115
116
public long getStartTime() {
117
return vmStartupTime;
118
}
119
120
public boolean isBootClassPathSupported() {
121
return jvm.isBootClassPathSupported();
122
}
123
124
public Map<String,String> getSystemProperties() {
125
Properties sysProps = System.getProperties();
126
Map<String,String> map = new HashMap<>();
127
128
// Properties.entrySet() does not include the entries in
129
// the default properties. So use Properties.stringPropertyNames()
130
// to get the list of property keys including the default ones.
131
Set<String> keys = sysProps.stringPropertyNames();
132
for (String k : keys) {
133
String value = sysProps.getProperty(k);
134
map.put(k, value);
135
}
136
137
return map;
138
}
139
140
public ObjectName getObjectName() {
141
return Util.newObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
142
}
143
144
}
145
146