8 Ocak 2018 Pazartesi

JMX MemoryMXBean Arayüzü

Giriş
Açıklaması şöyle.

  • ClassLoadingMXBean: Monitors the class loading system.
  • CompilationMXBean: Monitors the compilation system.
  • GarbageCollectionMXBean: Monitors the JVM's garbage collectors.
  • MemoryMXBean: Monitors the JVM's heap and nonheap memory spaces.
  • MemoryPoolMXBean: Monitors memory pools allocated by the JVM.
  • RuntimeMXBean: Monitors the runtime system. This MXBean offers few useful monitoring metrics, but it does provide the JVM's input arguments and the start time and up time, both of which can be useful as factors in other derived metrics.
  • ThreadMXBean: Monitors the threading system.
addNotificationListener metodu
Şöyle yaparız.
MemoryMXBean mBean = ManagementFactory.getMemoryMXBean();
((NotificationEmitter)mBean).addNotificationListener(
  (n, mb) -> {
    ...
  },
  n -> n.getType().equals(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED),
  mBean);

Hiç yorum yok:

Yorum Gönder