src/hotspot/share/runtime/serviceThread.cpp
changeset 50445 bd6b78feb6a3
parent 50217 843fc56f4686
child 51405 8b23aa7cef47
equal deleted inserted replaced
50444:db65921e9a9b 50445:bd6b78feb6a3
    21  * questions.
    21  * questions.
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
       
    26 #include "classfile/stringTable.hpp"
    26 #include "runtime/interfaceSupport.inline.hpp"
    27 #include "runtime/interfaceSupport.inline.hpp"
    27 #include "runtime/javaCalls.hpp"
    28 #include "runtime/javaCalls.hpp"
    28 #include "runtime/serviceThread.hpp"
    29 #include "runtime/serviceThread.hpp"
    29 #include "runtime/mutexLocker.hpp"
    30 #include "runtime/mutexLocker.hpp"
    30 #include "runtime/os.hpp"
    31 #include "runtime/os.hpp"
    80     bool sensors_changed = false;
    81     bool sensors_changed = false;
    81     bool has_jvmti_events = false;
    82     bool has_jvmti_events = false;
    82     bool has_gc_notification_event = false;
    83     bool has_gc_notification_event = false;
    83     bool has_dcmd_notification_event = false;
    84     bool has_dcmd_notification_event = false;
    84     bool acs_notify = false;
    85     bool acs_notify = false;
       
    86     bool stringtable_work = false;
    85     JvmtiDeferredEvent jvmti_event;
    87     JvmtiDeferredEvent jvmti_event;
    86     {
    88     {
    87       // Need state transition ThreadBlockInVM so that this thread
    89       // Need state transition ThreadBlockInVM so that this thread
    88       // will be handled by safepoint correctly when this thread is
    90       // will be handled by safepoint correctly when this thread is
    89       // notified at a safepoint.
    91       // notified at a safepoint.
    96 
    98 
    97       MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
    99       MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
    98       while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
   100       while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
    99              !(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
   101              !(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
   100               !(has_gc_notification_event = GCNotifier::has_event()) &&
   102               !(has_gc_notification_event = GCNotifier::has_event()) &&
   101               !(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification())) {
   103               !(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification()) &&
       
   104               !(stringtable_work = StringTable::has_work())) {
   102         // wait until one of the sensors has pending requests, or there is a
   105         // wait until one of the sensors has pending requests, or there is a
   103         // pending JVMTI event or JMX GC notification to post
   106         // pending JVMTI event or JMX GC notification to post
   104         Service_lock->wait(Mutex::_no_safepoint_check_flag);
   107         Service_lock->wait(Mutex::_no_safepoint_check_flag);
   105       }
   108       }
   106 
   109 
   107       if (has_jvmti_events) {
   110       if (has_jvmti_events) {
   108         jvmti_event = JvmtiDeferredEventQueue::dequeue();
   111         jvmti_event = JvmtiDeferredEventQueue::dequeue();
   109       }
   112       }
       
   113     }
       
   114 
       
   115     if (stringtable_work) {
       
   116       StringTable::do_concurrent_work(jt);
   110     }
   117     }
   111 
   118 
   112     if (has_jvmti_events) {
   119     if (has_jvmti_events) {
   113       jvmti_event.post();
   120       jvmti_event.post();
   114     }
   121     }