src/share/vm/runtime/serviceThread.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -27,10 +27,12 @@
#include "runtime/javaCalls.hpp"
#include "runtime/serviceThread.hpp"
#include "runtime/mutexLocker.hpp"
#include "prims/jvmtiImpl.hpp"
#include "services/gcNotifier.hpp"
+#include "services/diagnosticArgument.hpp"
+#include "services/diagnosticFramework.hpp"
ServiceThread* ServiceThread::_instance = NULL;
void ServiceThread::initialize() {
EXCEPTION_MARK;
@@ -81,10 +83,11 @@
void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
while (true) {
bool sensors_changed = false;
bool has_jvmti_events = false;
bool has_gc_notification_event = false;
+ bool has_dcmd_notification_event = false;
JvmtiDeferredEvent jvmti_event;
{
// Need state transition ThreadBlockInVM so that this thread
// will be handled by safepoint correctly when this thread is
// notified at a safepoint.
@@ -96,11 +99,12 @@
ThreadBlockInVM tbivm(jt);
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
!(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
- !(has_gc_notification_event = GCNotifier::has_event())) {
+ !(has_gc_notification_event = GCNotifier::has_event()) &&
+ !(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification())) {
// wait until one of the sensors has pending requests, or there is a
// pending JVMTI event or JMX GC notification to post
Service_lock->wait(Mutex::_no_safepoint_check_flag);
}
@@ -118,11 +122,15 @@
}
if(has_gc_notification_event) {
GCNotifier::sendNotification(CHECK);
}
+
+ if(has_dcmd_notification_event) {
+ DCmdFactory::send_notification(CHECK);
}
+ }
}
bool ServiceThread::is_service_thread(Thread* thread) {
return thread == _instance;
}