< prev index next >

src/hotspot/share/services/threadService.cpp

Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47288 : sspitsyn, dcubed, eosterlund CR - minor changes prior to OpenJDK review.
rev 47289 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp
rev 47290 : eosterlund CR - need more inline fixes.
rev 47291 : eosterlund, stefank CR - more inline and style cleanups
rev 47292 : stefank, coleenp CR - refactor most JavaThreadIterator usage to use JavaThreadIteratorWithHandle.


 937   bool oldJavaMonitorsInStackTrace = JavaMonitorsInStackTrace;
 938   JavaMonitorsInStackTrace = true;
 939   st->print_cr("Java stack information for the threads listed above:");
 940   st->print_cr("===================================================");
 941   for (int j = 0; j < len; j++) {
 942     currentThread = _threads->at(j);
 943     st->print_cr("\"%s\":", currentThread->get_thread_name());
 944     currentThread->print_stack_on(st);
 945   }
 946   JavaMonitorsInStackTrace = oldJavaMonitorsInStackTrace;
 947 }
 948 
 949 ThreadsListEnumerator::ThreadsListEnumerator(Thread* cur_thread,
 950                                              bool include_jvmti_agent_threads,
 951                                              bool include_jni_attaching_threads) {
 952   assert(cur_thread == Thread::current(), "Check current thread");
 953 
 954   int init_size = ThreadService::get_live_thread_count();
 955   _threads_array = new GrowableArray<instanceHandle>(init_size);
 956 
 957   ThreadsListHandle tlh;
 958   JavaThreadIterator jti(tlh.list());
 959   for (JavaThread* jt = jti.first(); jt != NULL; jt = jti.next()) {
 960     // skips JavaThreads in the process of exiting
 961     // and also skips VM internal JavaThreads
 962     // Threads in _thread_new or _thread_new_trans state are included.
 963     // i.e. threads have been started but not yet running.
 964     if (jt->threadObj() == NULL   ||
 965         jt->is_exiting() ||
 966         !java_lang_Thread::is_alive(jt->threadObj())   ||
 967         jt->is_hidden_from_external_view()) {
 968       continue;
 969     }
 970 
 971     // skip agent threads
 972     if (!include_jvmti_agent_threads && jt->is_jvmti_agent_thread()) {
 973       continue;
 974     }
 975 
 976     // skip jni threads in the process of attaching
 977     if (!include_jni_attaching_threads && jt->is_attaching_via_jni()) {
 978       continue;
 979     }


 937   bool oldJavaMonitorsInStackTrace = JavaMonitorsInStackTrace;
 938   JavaMonitorsInStackTrace = true;
 939   st->print_cr("Java stack information for the threads listed above:");
 940   st->print_cr("===================================================");
 941   for (int j = 0; j < len; j++) {
 942     currentThread = _threads->at(j);
 943     st->print_cr("\"%s\":", currentThread->get_thread_name());
 944     currentThread->print_stack_on(st);
 945   }
 946   JavaMonitorsInStackTrace = oldJavaMonitorsInStackTrace;
 947 }
 948 
 949 ThreadsListEnumerator::ThreadsListEnumerator(Thread* cur_thread,
 950                                              bool include_jvmti_agent_threads,
 951                                              bool include_jni_attaching_threads) {
 952   assert(cur_thread == Thread::current(), "Check current thread");
 953 
 954   int init_size = ThreadService::get_live_thread_count();
 955   _threads_array = new GrowableArray<instanceHandle>(init_size);
 956 
 957   for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {


 958     // skips JavaThreads in the process of exiting
 959     // and also skips VM internal JavaThreads
 960     // Threads in _thread_new or _thread_new_trans state are included.
 961     // i.e. threads have been started but not yet running.
 962     if (jt->threadObj() == NULL   ||
 963         jt->is_exiting() ||
 964         !java_lang_Thread::is_alive(jt->threadObj())   ||
 965         jt->is_hidden_from_external_view()) {
 966       continue;
 967     }
 968 
 969     // skip agent threads
 970     if (!include_jvmti_agent_threads && jt->is_jvmti_agent_thread()) {
 971       continue;
 972     }
 973 
 974     // skip jni threads in the process of attaching
 975     if (!include_jni_attaching_threads && jt->is_attaching_via_jni()) {
 976       continue;
 977     }
< prev index next >