GarbageCollectorImpl は NotificationEmitter 機能を有している. これは GarbageCollectorImpl が MemoryManagerImpl のサブクラスであり, この MemoryManagerImpl が NotificationEmitterSupport のサブクラスであるため.
機能としては「GC 終了時に登録されているリスナーに通知を送る」というもの. 内部的には GCNotifier クラスと ServiceThread によって実現されている.
(なお, このメソッドは JSR-174 には存在しない Sun Microsystems の独自拡張機能)
sun.management.GarbageCollectorImpl.addNotificationListener()
-> sun.management.NotificationEmitterSupport.addNotificationListener()
-> sun.management.GarbageCollectorImpl.setNotificationEnabled()
-> Java_sun_management_GarbageCollectorImpl_setNotificationEnabled()
-> jmm_SetGCNotificationEnabled()
-> GCMemoryManager::set_notification_enabled()
(GC 終了後に TraceMemoryManagerStats のデストラクタから呼び出される)
TraceMemoryManagerStats::~TraceMemoryManagerStats()
-> MemoryService::gc_end()
-> GCMemoryManager::gc_end()
(GCMemoryManager::is_notification_enabled() が true だと GCNotifier::pushNotification() が呼ばれる)
-> GCNotifier::pushNotification()
-> GCNotifier::addRequest()
-> Monitor::notify_all() (<= ServiceThread を起床させる)
ServiceThread::service_thread_entry()
-> GCNotifier::sendNotification()
-> sun.management.GarbageCollectorImpl.createGCNotification()
-> sun.management.NotificationEmitterSupport.sendNotification()
See: here for details
(#Under Construction)
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
(#Under Construction)
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.