src/hotspot/share/services/attachListener.cpp
changeset 50217 843fc56f4686
parent 49902 3661f31c6df4
child 50785 d1b24f2ceca5
equal deleted inserted replaced
50216:f4fd580dd7d1 50217:843fc56f4686
   407 }
   407 }
   408 
   408 
   409 // Starts the Attach Listener thread
   409 // Starts the Attach Listener thread
   410 void AttachListener::init() {
   410 void AttachListener::init() {
   411   EXCEPTION_MARK;
   411   EXCEPTION_MARK;
   412   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, THREAD);
       
   413   if (has_init_error(THREAD)) {
       
   414     return;
       
   415   }
       
   416 
       
   417   InstanceKlass* klass = InstanceKlass::cast(k);
       
   418   instanceHandle thread_oop = klass->allocate_instance_handle(THREAD);
       
   419   if (has_init_error(THREAD)) {
       
   420     return;
       
   421   }
       
   422 
   412 
   423   const char thread_name[] = "Attach Listener";
   413   const char thread_name[] = "Attach Listener";
   424   Handle string = java_lang_String::create_from_str(thread_name, THREAD);
   414   Handle string = java_lang_String::create_from_str(thread_name, THREAD);
   425   if (has_init_error(THREAD)) {
   415   if (has_init_error(THREAD)) {
   426     return;
   416     return;
   427   }
   417   }
   428 
   418 
   429   // Initialize thread_oop to put it into the system threadGroup
   419   // Initialize thread_oop to put it into the system threadGroup
   430   Handle thread_group (THREAD, Universe::system_thread_group());
   420   Handle thread_group (THREAD, Universe::system_thread_group());
   431   JavaValue result(T_VOID);
   421   Handle thread_oop = JavaCalls::construct_new_instance(SystemDictionary::Thread_klass(),
   432   JavaCalls::call_special(&result, thread_oop,
       
   433                        klass,
       
   434                        vmSymbols::object_initializer_name(),
       
   435                        vmSymbols::threadgroup_string_void_signature(),
   422                        vmSymbols::threadgroup_string_void_signature(),
   436                        thread_group,
   423                        thread_group,
   437                        string,
   424                        string,
   438                        THREAD);
   425                        THREAD);
   439 
       
   440   if (has_init_error(THREAD)) {
   426   if (has_init_error(THREAD)) {
   441     return;
   427     return;
   442   }
   428   }
   443 
   429 
   444   Klass* group = SystemDictionary::ThreadGroup_klass();
   430   Klass* group = SystemDictionary::ThreadGroup_klass();
       
   431   JavaValue result(T_VOID);
   445   JavaCalls::call_special(&result,
   432   JavaCalls::call_special(&result,
   446                         thread_group,
   433                         thread_group,
   447                         group,
   434                         group,
   448                         vmSymbols::add_method_name(),
   435                         vmSymbols::add_method_name(),
   449                         vmSymbols::thread_void_signature(),
   436                         vmSymbols::thread_void_signature(),
   450                         thread_oop,             // ARG 1
   437                         thread_oop,
   451                         THREAD);
   438                         THREAD);
   452   if (has_init_error(THREAD)) {
   439   if (has_init_error(THREAD)) {
   453     return;
   440     return;
   454   }
   441   }
   455 
   442