2
2
3
3
import java .io .Closeable ;
4
4
import java .io .File ;
5
- import java .io .IOException ;
6
5
import java .util .ArrayList ;
7
6
import java .util .HashMap ;
8
7
import java .util .Iterator ;
@@ -135,24 +134,30 @@ public long getMemoryUsedSize() {
135
134
}
136
135
137
136
public void dumpMemoryUsage (File target ) {
138
- if (target == null || !target .exists ()) {
139
- return ;
137
+ checkSameThread ();
138
+ checkDestroyed ();
139
+ String fileName = null ;
140
+ if (target != null && target .exists ()) {
141
+ fileName = target .getAbsolutePath ();
140
142
}
141
143
142
- dumpMemoryUsage (runtime , target . getAbsolutePath () );
144
+ dumpMemoryUsage (runtime , fileName );
143
145
}
144
146
145
147
// will use stdout to print.
146
148
public void dumpMemoryUsage () {
147
- dumpMemoryUsage (runtime , null );
149
+ dumpMemoryUsage (null );
148
150
}
149
151
150
152
public void dumpObjects (File target ) {
151
- if (target == null || !target .exists ()) {
152
- return ;
153
+ checkSameThread ();
154
+ checkDestroyed ();
155
+ String fileName = null ;
156
+ if (target != null && target .exists ()) {
157
+ fileName = target .getAbsolutePath ();
153
158
}
154
159
155
- dumpObjects (runtime , target . getAbsolutePath () );
160
+ dumpObjects (runtime , fileName );
156
161
}
157
162
158
163
public JSObjectCreator getCreator () {
@@ -161,7 +166,7 @@ public JSObjectCreator getCreator() {
161
166
162
167
// will use stdout to print.
163
168
public void dumpObjects () {
164
- dumpObjects (runtime , null );
169
+ dumpObjects (null );
165
170
}
166
171
167
172
private final long runtime ;
0 commit comments