src/share/vm/runtime/serviceThread.cpp

changeset 2888
78542e2b5e35
parent 2623
216d916d5c12
child 5047
31a4e55f8c9d
     1.1 --- a/src/share/vm/runtime/serviceThread.cpp	Wed May 11 13:19:53 2011 -0400
     1.2 +++ b/src/share/vm/runtime/serviceThread.cpp	Thu May 12 10:30:11 2011 -0700
     1.3 @@ -28,6 +28,7 @@
     1.4  #include "runtime/serviceThread.hpp"
     1.5  #include "runtime/mutexLocker.hpp"
     1.6  #include "prims/jvmtiImpl.hpp"
     1.7 +#include "services/gcNotifier.hpp"
     1.8  
     1.9  ServiceThread* ServiceThread::_instance = NULL;
    1.10  
    1.11 @@ -81,6 +82,7 @@
    1.12    while (true) {
    1.13      bool sensors_changed = false;
    1.14      bool has_jvmti_events = false;
    1.15 +    bool has_gc_notification_event = false;
    1.16      JvmtiDeferredEvent jvmti_event;
    1.17      {
    1.18        // Need state transition ThreadBlockInVM so that this thread
    1.19 @@ -95,9 +97,10 @@
    1.20  
    1.21        MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
    1.22        while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
    1.23 -             !(has_jvmti_events = JvmtiDeferredEventQueue::has_events())) {
    1.24 +             !(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
    1.25 +              !(has_gc_notification_event = GCNotifier::has_event())) {
    1.26          // wait until one of the sensors has pending requests, or there is a
    1.27 -        // pending JVMTI event to post
    1.28 +        // pending JVMTI event or JMX GC notification to post
    1.29          Service_lock->wait(Mutex::_no_safepoint_check_flag);
    1.30        }
    1.31  
    1.32 @@ -113,6 +116,10 @@
    1.33      if (sensors_changed) {
    1.34        LowMemoryDetector::process_sensor_changes(jt);
    1.35      }
    1.36 +
    1.37 +    if(has_gc_notification_event) {
    1.38 +        GCNotifier::sendNotification(CHECK);
    1.39 +    }
    1.40    }
    1.41  }
    1.42  

mercurial