Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/test/functional/RasapiTest/dummy_src/com/ibm/jvm/Dump.java
6005 views
1
/*******************************************************************************
2
* Copyright (c) 2006, 2021 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
package com.ibm.jvm;
23
24
import java.security.AccessController;
25
import java.security.PrivilegedAction;
26
27
/**
28
* This class is used to trigger and configure the options used to produce different
29
* types of diagnostic dumps available from the IBM JVM.
30
* <p>
31
* -Xdump must be enabled on the command line or the functions that attempt to cause
32
* dumps to be created or set options will fail with a java.lang.RuntimeException.
33
* <p>
34
* The methods on this class can be used to trigger dumps, configure dump options and
35
* query those options.
36
* <p>
37
* The {@link #JavaDump()}, {@link #SystemDump()}, {@link #HeapDump()} and {@link #SnapDump()}
38
* methods trigger dumps of the given type with no options and no return value.
39
* Although they are not configurable they do provide an easy API to use via reflection
40
* if your code is likely to run on both IBM and non-IBM JVMs and you only need the most
41
* basic ability to create a dump.
42
* <p>
43
* The {@link #javaDumpToFile()}, {@link #systemDumpToFile()}, {@link #heapDumpToFile()} and
44
* {@link #snapDumpToFile()} methods allow a destination file to be optionally specified and
45
* will return the full path of the file that is created.
46
* <br>
47
* The recommended usage of the {@link #javaDumpToFile()}, {@link #systemDumpToFile()},
48
* {@link #heapDumpToFile()} and {@link #snapDumpToFile()}
49
* methods is to call the no argument versions of these calls rather than specifying a file
50
* name as this will trigger a dump to the default location. Your dump file will go to the
51
* default location specified by any -Xdump options given to the JVM at startup time following
52
* the user or administrators preferences.
53
* The location the dump file was written to will be returned as a String so the generated
54
* file can be located.
55
* <p>
56
* The {@link #triggerDump(String)} method offers similar functionality as the DumpToFile() methods
57
* but with the ability to specify any dump options that are meaningful for a dump that occurs
58
* immediately. The options are passed as a String that follows the same format as the option
59
* strings passed to -Xdump on the command line.<br>
60
* For example:
61
* <ul>
62
* <li>triggerDump("java") is equivalent to javaDumpToFile() or javaDumpToFile(null) all three
63
* will cause a javadump to be generated to the default location.</li>
64
* <li>triggerDump("heap:file=heapdump.phd") is equivalent to heapDumpToFile("heapdump.phd")</li>
65
* <li>triggerDump("heap:file=heapdump.txt,opts=CLASSIC") allows you to specify the CLASSIC
66
* option to triggerDump and produce a text format heap dump which is not possible through
67
* the *DumpToFile(String filename) or *Dump() methods.</li>
68
* <li>triggerDump("java:request=exclusive") will trigger a java dump with the request option set
69
* to "exclusive" and any other options, including the file name, taken from the default options
70
* for java dumps</li>
71
* </ul>
72
* <p>
73
* The {@link #setDumpOptions(String)} method allows dump options that will cause or change how
74
* a dump occurs for an event in the future to be specified. The options are specified in the
75
* format expected by the -Xdump command line. Not all options can be configured at runtime and
76
* this method will throw an InvalidDumpOption exception if it is passed an option that cannot be set.<p>
77
* For example:
78
* <ul>
79
* <li>setDumpOptions("java") - enable java dumps with the default settings.</li>
80
* <li>setDumpOptions("java:events=vmstop") - enable java dumps on the vmstop event (this will
81
* occur once when the JVM exits).</li>
82
* <li>setDumpOptions("none") - disable all dump agents on all events.</li>
83
* <li>setDumpOptions("heap:none") - disable all heap dump agents on all events.</li>
84
* <li>setDumpOptions("system:none:events=systhrow,filter=java/lang/OutOfMemoryError") - disable
85
* system dumps on systhrow events for OutOfMemory errors only.</li>
86
* </ul>
87
* For full details of dump options see the section on dump agents in the documentation for the IBM JVM.
88
* <p>
89
* The {@link #queryDumpOptions()} method returns a String array containing a snapshot of the currently
90
* configured dump options. Each String is in the format expected by the -Xdump command line
91
* option and setDumpOptions. The Strings can be passed back to setDumpOptions to recreate
92
* the current dump agent configuration at a later time.
93
* <p>
94
* The {@link #resetDumpOptions()} method resets the dump options to the settings specified when the
95
* JVM was started removing any additional configuration done since then.<br>
96
* If you wish to change the dump configuration at runtime and then reset it to an earlier
97
* state that included additional runtime configuration done through this API or JVMTI you should
98
* consider saving the result of queryDumpOptions and then later use {@link #setDumpOptions(String)}
99
* to restore that configuration after a call to setDumpOptions("none") to clear all dump agent
100
* configuration.
101
*/
102
public class Dump {
103
104
public static void JavaDump() {
105
}
106
107
public static void HeapDump() {
108
}
109
110
public static void SystemDump() {
111
}
112
113
private Dump() {
114
}
115
116
public static void SnapDump() {
117
}
118
119
public static String javaDumpToFile(String fileNamePattern ) throws InvalidDumpOptionException {
120
return null;
121
}
122
123
public static String javaDumpToFile() {
124
return null;
125
}
126
127
public static String heapDumpToFile(String fileNamePattern ) throws InvalidDumpOptionException {
128
return null;
129
}
130
131
public static String heapDumpToFile() {
132
return null;
133
}
134
135
136
public static String systemDumpToFile(String fileNamePattern) throws InvalidDumpOptionException {
137
return null; }
138
139
public static String systemDumpToFile() {
140
return null;
141
}
142
public static String snapDumpToFile(String fileNamePattern) throws InvalidDumpOptionException {
143
return null;
144
}
145
public static String snapDumpToFile() {
146
return null;
147
}
148
149
public static String triggerDump(String dumpOptions) throws InvalidDumpOptionException {
150
return null;
151
}
152
153
public static void setDumpOptions(String dumpOptions) throws InvalidDumpOptionException, DumpConfigurationUnavailableException {
154
}
155
156
public static String[] queryDumpOptions() {
157
return null;
158
}
159
160
public static void resetDumpOptions() throws DumpConfigurationUnavailableException {
161
}
162
163
}
164
165