author | vdeshpande |
Fri, 15 Dec 2017 10:44:06 -0800 | |
changeset 48371 | 291020144f22 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
2 |
* Copyright (c) 2003, 2015, 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 |
||
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
26 |
package com.sun.management.internal; |
2 | 27 |
|
21641
c8114b367cf4
8028099: Many com/sun/management/OperatingSystemMXBean tests failing with CCE (win)
alanb
parents:
21633
diff
changeset
|
28 |
import com.sun.management.OperatingSystemMXBean; |
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
29 |
import sun.management.BaseOperatingSystemImpl; |
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
30 |
import sun.management.VMManagement; |
2 | 31 |
|
32 |
/** |
|
33 |
* Implementation class for the operating system. |
|
34 |
* Standard and committed hotspot-specific metrics if any. |
|
35 |
* |
|
36 |
* ManagementFactory.getOperatingSystemMXBean() returns an instance |
|
37 |
* of this class. |
|
38 |
*/ |
|
21633
6cc4c9a56216
8025985: com.sun.management.OSMBeanFactory should not be public
mchung
parents:
14342
diff
changeset
|
39 |
class OperatingSystemImpl extends BaseOperatingSystemImpl |
2 | 40 |
implements OperatingSystemMXBean { |
41 |
||
42 |
// psapiLock is a lock to make sure only one thread loading |
|
43 |
// PSAPI DLL. |
|
44 |
private static Object psapiLock = new Object(); |
|
45 |
||
21633
6cc4c9a56216
8025985: com.sun.management.OSMBeanFactory should not be public
mchung
parents:
14342
diff
changeset
|
46 |
OperatingSystemImpl(VMManagement vm) { |
2 | 47 |
super(vm); |
48 |
} |
|
49 |
||
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
50 |
@Override |
2 | 51 |
public long getCommittedVirtualMemorySize() { |
52 |
synchronized (psapiLock) { |
|
53 |
return getCommittedVirtualMemorySize0(); |
|
54 |
} |
|
55 |
} |
|
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
56 |
|
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
57 |
@Override |
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
58 |
public long getTotalSwapSpaceSize() { |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
59 |
return getTotalSwapSpaceSize0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
60 |
} |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
61 |
|
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
62 |
@Override |
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
63 |
public long getFreeSwapSpaceSize() { |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
64 |
return getFreeSwapSpaceSize0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
65 |
} |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
66 |
|
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
67 |
@Override |
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
68 |
public long getProcessCpuTime() { |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
69 |
return getProcessCpuTime0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
70 |
} |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
71 |
|
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
72 |
@Override |
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
73 |
public long getFreePhysicalMemorySize() { |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
74 |
return getFreePhysicalMemorySize0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
75 |
} |
2 | 76 |
|
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
77 |
@Override |
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
78 |
public long getTotalPhysicalMemorySize() { |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
79 |
return getTotalPhysicalMemorySize0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
80 |
} |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
81 |
|
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
82 |
@Override |
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
83 |
public double getSystemCpuLoad() { |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
84 |
return getSystemCpuLoad0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
85 |
} |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
86 |
|
30355
e37c7eba132f
8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents:
25859
diff
changeset
|
87 |
@Override |
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
88 |
public double getProcessCpuLoad() { |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
89 |
return getProcessCpuLoad0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
90 |
} |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
91 |
|
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
92 |
/* native methods */ |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
93 |
private native long getCommittedVirtualMemorySize0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
94 |
private native long getFreePhysicalMemorySize0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
95 |
private native long getFreeSwapSpaceSize0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
96 |
private native double getProcessCpuLoad0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
97 |
private native long getProcessCpuTime0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
98 |
private native double getSystemCpuLoad0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
99 |
private native long getTotalPhysicalMemorySize0(); |
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
100 |
private native long getTotalSwapSpaceSize0(); |
2 | 101 |
|
102 |
static { |
|
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
103 |
initialize0(); |
2 | 104 |
} |
22583
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
105 |
|
e7d5af0b11e9
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
dsamersoff
parents:
21641
diff
changeset
|
106 |
private static native void initialize0(); |
2 | 107 |
} |