205 // getHeapMemoryUsage() never returns null.
206 //
207 // if (u == null) u=MemoryUsage.INVALID;
208
209 m.put(heapMemoryTag,u);
210 return u;
211 }
212
213 // Should never come here.
214 // Log error!
215 log.trace("getHeapMemoryUsage", "ERROR: should never come here!");
216 return getMemoryUsage(MemoryType.HEAP);
217 } catch (RuntimeException x) {
218 log.trace("getHeapMemoryUsage",
219 "Failed to get HeapMemoryUsage: " + x);
220 log.debug("getHeapMemoryUsage",x);
221 throw x;
222 }
223 }
224
225 static final Long Long0 = new Long(0);
226
227 /**
228 * Getter for the "JvmMemoryNonHeapMaxSize" variable.
229 */
230 public Long getJvmMemoryNonHeapMaxSize()
231 throws SnmpStatusException {
232 final long val = getNonHeapMemoryUsage().getMax();
233 if (val > -1) return new Long(val);
234 else return Long0;
235 }
236
237 /**
238 * Getter for the "JvmMemoryNonHeapCommitted" variable.
239 */
240 public Long getJvmMemoryNonHeapCommitted() throws SnmpStatusException {
241 final long val = getNonHeapMemoryUsage().getCommitted();
242 if (val > -1) return new Long(val);
243 else return Long0;
244 }
245
246 /**
247 * Getter for the "JvmMemoryNonHeapUsed" variable.
248 */
249 public Long getJvmMemoryNonHeapUsed() throws SnmpStatusException {
250 final long val = getNonHeapMemoryUsage().getUsed();
251 if (val > -1) return new Long(val);
252 else return Long0;
253 }
254
255 /**
256 * Getter for the "JvmMemoryNonHeapInitSize" variable.
257 */
258 public Long getJvmMemoryNonHeapInitSize() throws SnmpStatusException {
259 final long val = getNonHeapMemoryUsage().getInit();
260 if (val > -1) return new Long(val);
261 else return Long0;
262 }
263
264 /**
265 * Getter for the "JvmMemoryHeapMaxSize" variable.
266 */
267 public Long getJvmMemoryHeapMaxSize() throws SnmpStatusException {
268 final long val = getHeapMemoryUsage().getMax();
269 if (val > -1) return new Long(val);
270 else return Long0;
271 }
272
273 /**
274 * Getter for the "JvmMemoryGCCall" variable.
275 */
276 public EnumJvmMemoryGCCall getJvmMemoryGCCall()
277 throws SnmpStatusException {
278 final Map<Object,Object> m = JvmContextFactory.getUserData();
279
280 if (m != null) {
281 final EnumJvmMemoryGCCall cached
282 = (EnumJvmMemoryGCCall) m.get("jvmMemory.getJvmMemoryGCCall");
283 if (cached != null) return cached;
284 }
285 return JvmMemoryGCCallSupported;
286 }
287
288 /**
289 * Setter for the "JvmMemoryGCCall" variable.
303 }
304 return;
305 }
306 throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
307 }
308
309 /**
310 * Checker for the "JvmMemoryGCCall" variable.
311 */
312 public void checkJvmMemoryGCCall(EnumJvmMemoryGCCall x)
313 throws SnmpStatusException {
314 if (x.intValue() != JvmMemoryGCCallStart.intValue())
315 throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
316 }
317
318 /**
319 * Getter for the "JvmMemoryHeapCommitted" variable.
320 */
321 public Long getJvmMemoryHeapCommitted() throws SnmpStatusException {
322 final long val = getHeapMemoryUsage().getCommitted();
323 if (val > -1) return new Long(val);
324 else return Long0;
325 }
326
327 /**
328 * Getter for the "JvmMemoryGCVerboseLevel" variable.
329 */
330 public EnumJvmMemoryGCVerboseLevel getJvmMemoryGCVerboseLevel()
331 throws SnmpStatusException {
332 if (ManagementFactory.getMemoryMXBean().isVerbose())
333 return JvmMemoryGCVerboseLevelVerbose;
334 else
335 return JvmMemoryGCVerboseLevelSilent;
336 }
337
338 /**
339 * Setter for the "JvmMemoryGCVerboseLevel" variable.
340 */
341 public void setJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x)
342 throws SnmpStatusException {
343 if (JvmMemoryGCVerboseLevelVerbose.intValue() == x.intValue())
344 ManagementFactory.getMemoryMXBean().setVerbose(true);
345 else
346 ManagementFactory.getMemoryMXBean().setVerbose(false);
347 }
348
349 /**
350 * Checker for the "JvmMemoryGCVerboseLevel" variable.
351 */
352 public void checkJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x)
353 throws SnmpStatusException {
354 // Nothing to check...
355 }
356
357 /**
358 * Getter for the "JvmMemoryHeapUsed" variable.
359 */
360 public Long getJvmMemoryHeapUsed() throws SnmpStatusException {
361 final long val = getHeapMemoryUsage().getUsed();
362 if (val > -1) return new Long(val);
363 else return Long0;
364 }
365
366 /**
367 * Getter for the "JvmMemoryHeapInitSize" variable.
368 */
369 public Long getJvmMemoryHeapInitSize() throws SnmpStatusException {
370 final long val = getHeapMemoryUsage().getInit();
371 if (val > -1) return new Long(val);
372 else return Long0;
373 }
374
375 /**
376 * Getter for the "JvmMemoryPendingFinalCount" variable.
377 */
378 public Long getJvmMemoryPendingFinalCount()
379 throws SnmpStatusException {
380 final long val = ManagementFactory.getMemoryMXBean().
381 getObjectPendingFinalizationCount();
382
383 if (val > -1) return new Long((int)val);
384
385 // Should never happen... but stay safe all the same.
386 //
387 else return new Long(0);
388 }
389
390 static final MibLogger log = new MibLogger(JvmMemoryImpl.class);
391 }
|
205 // getHeapMemoryUsage() never returns null.
206 //
207 // if (u == null) u=MemoryUsage.INVALID;
208
209 m.put(heapMemoryTag,u);
210 return u;
211 }
212
213 // Should never come here.
214 // Log error!
215 log.trace("getHeapMemoryUsage", "ERROR: should never come here!");
216 return getMemoryUsage(MemoryType.HEAP);
217 } catch (RuntimeException x) {
218 log.trace("getHeapMemoryUsage",
219 "Failed to get HeapMemoryUsage: " + x);
220 log.debug("getHeapMemoryUsage",x);
221 throw x;
222 }
223 }
224
225 static final Long Long0 = 0L;
226
227 /**
228 * Getter for the "JvmMemoryNonHeapMaxSize" variable.
229 */
230 public Long getJvmMemoryNonHeapMaxSize()
231 throws SnmpStatusException {
232 final long val = getNonHeapMemoryUsage().getMax();
233 if (val > -1) return val;
234 else return Long0;
235 }
236
237 /**
238 * Getter for the "JvmMemoryNonHeapCommitted" variable.
239 */
240 public Long getJvmMemoryNonHeapCommitted() throws SnmpStatusException {
241 final long val = getNonHeapMemoryUsage().getCommitted();
242 if (val > -1) return val;
243 else return Long0;
244 }
245
246 /**
247 * Getter for the "JvmMemoryNonHeapUsed" variable.
248 */
249 public Long getJvmMemoryNonHeapUsed() throws SnmpStatusException {
250 final long val = getNonHeapMemoryUsage().getUsed();
251 if (val > -1) return val;
252 else return Long0;
253 }
254
255 /**
256 * Getter for the "JvmMemoryNonHeapInitSize" variable.
257 */
258 public Long getJvmMemoryNonHeapInitSize() throws SnmpStatusException {
259 final long val = getNonHeapMemoryUsage().getInit();
260 if (val > -1) return val;
261 else return Long0;
262 }
263
264 /**
265 * Getter for the "JvmMemoryHeapMaxSize" variable.
266 */
267 public Long getJvmMemoryHeapMaxSize() throws SnmpStatusException {
268 final long val = getHeapMemoryUsage().getMax();
269 if (val > -1) return val;
270 else return Long0;
271 }
272
273 /**
274 * Getter for the "JvmMemoryGCCall" variable.
275 */
276 public EnumJvmMemoryGCCall getJvmMemoryGCCall()
277 throws SnmpStatusException {
278 final Map<Object,Object> m = JvmContextFactory.getUserData();
279
280 if (m != null) {
281 final EnumJvmMemoryGCCall cached
282 = (EnumJvmMemoryGCCall) m.get("jvmMemory.getJvmMemoryGCCall");
283 if (cached != null) return cached;
284 }
285 return JvmMemoryGCCallSupported;
286 }
287
288 /**
289 * Setter for the "JvmMemoryGCCall" variable.
303 }
304 return;
305 }
306 throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
307 }
308
309 /**
310 * Checker for the "JvmMemoryGCCall" variable.
311 */
312 public void checkJvmMemoryGCCall(EnumJvmMemoryGCCall x)
313 throws SnmpStatusException {
314 if (x.intValue() != JvmMemoryGCCallStart.intValue())
315 throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
316 }
317
318 /**
319 * Getter for the "JvmMemoryHeapCommitted" variable.
320 */
321 public Long getJvmMemoryHeapCommitted() throws SnmpStatusException {
322 final long val = getHeapMemoryUsage().getCommitted();
323 if (val > -1) return val;
324 else return Long0;
325 }
326
327 /**
328 * Getter for the "JvmMemoryGCVerboseLevel" variable.
329 */
330 public EnumJvmMemoryGCVerboseLevel getJvmMemoryGCVerboseLevel()
331 throws SnmpStatusException {
332 if (ManagementFactory.getMemoryMXBean().isVerbose())
333 return JvmMemoryGCVerboseLevelVerbose;
334 else
335 return JvmMemoryGCVerboseLevelSilent;
336 }
337
338 /**
339 * Setter for the "JvmMemoryGCVerboseLevel" variable.
340 */
341 public void setJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x)
342 throws SnmpStatusException {
343 if (JvmMemoryGCVerboseLevelVerbose.intValue() == x.intValue())
344 ManagementFactory.getMemoryMXBean().setVerbose(true);
345 else
346 ManagementFactory.getMemoryMXBean().setVerbose(false);
347 }
348
349 /**
350 * Checker for the "JvmMemoryGCVerboseLevel" variable.
351 */
352 public void checkJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x)
353 throws SnmpStatusException {
354 // Nothing to check...
355 }
356
357 /**
358 * Getter for the "JvmMemoryHeapUsed" variable.
359 */
360 public Long getJvmMemoryHeapUsed() throws SnmpStatusException {
361 final long val = getHeapMemoryUsage().getUsed();
362 if (val > -1) return val;
363 else return Long0;
364 }
365
366 /**
367 * Getter for the "JvmMemoryHeapInitSize" variable.
368 */
369 public Long getJvmMemoryHeapInitSize() throws SnmpStatusException {
370 final long val = getHeapMemoryUsage().getInit();
371 if (val > -1) return val;
372 else return Long0;
373 }
374
375 /**
376 * Getter for the "JvmMemoryPendingFinalCount" variable.
377 */
378 public Long getJvmMemoryPendingFinalCount()
379 throws SnmpStatusException {
380 final long val = ManagementFactory.getMemoryMXBean().
381 getObjectPendingFinalizationCount();
382
383 if (val > -1) return val;
384
385 // Should never happen... but stay safe all the same.
386 //
387 else return 0L;
388 }
389
390 static final MibLogger log = new MibLogger(JvmMemoryImpl.class);
391 }
|