author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 36511 | jdk/src/java.management/share/classes/sun/management/RuntimeImpl.java@9d0388c6b336 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
21640
diff
changeset
|
2 |
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.management; |
|
27 |
||
28 |
import java.lang.management.RuntimeMXBean; |
|
401
ef01e0dccd63
6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents:
2
diff
changeset
|
29 |
import java.lang.management.ManagementFactory; |
2 | 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; |
|
401
ef01e0dccd63
6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents:
2
diff
changeset
|
36 |
import javax.management.ObjectName; |
2 | 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() { |
|
36511 | 99 |
throw new UnsupportedOperationException( |
100 |
"Boot class path mechanism is not supported"); |
|
2 | 101 |
} |
102 |
||
103 |
public List<String> getInputArguments() { |
|
401
ef01e0dccd63
6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents:
2
diff
changeset
|
104 |
Util.checkMonitorAccess(); |
2 | 105 |
return jvm.getVmArguments(); |
106 |
} |
|
107 |
||
108 |
public long getUptime() { |
|
21640
6bbdcc430310
6523160: RuntimeMXBean.getUptime() returns negative values
jbachorik
parents:
14342
diff
changeset
|
109 |
return jvm.getUptime(); |
2 | 110 |
} |
111 |
||
112 |
public long getStartTime() { |
|
113 |
return vmStartupTime; |
|
114 |
} |
|
115 |
||
116 |
public boolean isBootClassPathSupported() { |
|
36511 | 117 |
return false; |
2 | 118 |
} |
119 |
||
120 |
public Map<String,String> getSystemProperties() { |
|
121 |
Properties sysProps = System.getProperties(); |
|
11530
a9d059c15b80
7117570: Warnings in sun.mangement.* and its subpackages
mchung
parents:
5506
diff
changeset
|
122 |
Map<String,String> map = new HashMap<>(); |
2 | 123 |
|
124 |
// Properties.entrySet() does not include the entries in |
|
125 |
// the default properties. So use Properties.stringPropertyNames() |
|
126 |
// to get the list of property keys including the default ones. |
|
127 |
Set<String> keys = sysProps.stringPropertyNames(); |
|
128 |
for (String k : keys) { |
|
129 |
String value = sysProps.getProperty(k); |
|
130 |
map.put(k, value); |
|
131 |
} |
|
132 |
||
133 |
return map; |
|
134 |
} |
|
401
ef01e0dccd63
6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents:
2
diff
changeset
|
135 |
|
ef01e0dccd63
6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents:
2
diff
changeset
|
136 |
public ObjectName getObjectName() { |
4156 | 137 |
return Util.newObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME); |
401
ef01e0dccd63
6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents:
2
diff
changeset
|
138 |
} |
ef01e0dccd63
6610094: Add generic support for platform MXBeans of any type (also fixed 6681031)
mchung
parents:
2
diff
changeset
|
139 |
|
2 | 140 |
} |