--- a/hotspot/src/share/vm/runtime/serviceThread.cpp Wed May 11 13:19:53 2011 -0400
+++ b/hotspot/src/share/vm/runtime/serviceThread.cpp Thu May 12 10:30:11 2011 -0700
@@ -28,6 +28,7 @@
#include "runtime/serviceThread.hpp"
#include "runtime/mutexLocker.hpp"
#include "prims/jvmtiImpl.hpp"
+#include "services/gcNotifier.hpp"
ServiceThread* ServiceThread::_instance = NULL;
@@ -81,6 +82,7 @@
while (true) {
bool sensors_changed = false;
bool has_jvmti_events = false;
+ bool has_gc_notification_event = false;
JvmtiDeferredEvent jvmti_event;
{
// Need state transition ThreadBlockInVM so that this thread
@@ -95,9 +97,10 @@
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
- !(has_jvmti_events = JvmtiDeferredEventQueue::has_events())) {
+ !(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
+ !(has_gc_notification_event = GCNotifier::has_event())) {
// wait until one of the sensors has pending requests, or there is a
- // pending JVMTI event to post
+ // pending JVMTI event or JMX GC notification to post
Service_lock->wait(Mutex::_no_safepoint_check_flag);
}
@@ -113,6 +116,10 @@
if (sensors_changed) {
LowMemoryDetector::process_sensor_changes(jt);
}
+
+ if(has_gc_notification_event) {
+ GCNotifier::sendNotification(CHECK);
+ }
}
}