632 } else if (phase == JVMTI_PHASE_LIVE) {
633 // The phase is checked by the wrapper that called this function,
634 // but this thread could be racing with the thread that is
635 // terminating the VM so we check one more time.
636
637 // create the zip entry
638 ClassPathZipEntry* zip_entry = ClassLoader::create_class_path_zip_entry(segment, true);
639 if (zip_entry == NULL) {
640 return JVMTI_ERROR_ILLEGAL_ARGUMENT;
641 }
642
643 // lock the loader
644 Thread* thread = Thread::current();
645 HandleMark hm;
646 Handle loader_lock = Handle(thread, SystemDictionary::system_loader_lock());
647
648 ObjectLocker ol(loader_lock, thread);
649
650 // add the jar file to the bootclasspath
651 log_info(class, load)("opened: %s", zip_entry->name());
652 ClassLoaderExt::append_boot_classpath(zip_entry);
653 return JVMTI_ERROR_NONE;
654 } else {
655 return JVMTI_ERROR_WRONG_PHASE;
656 }
657
658 } /* end AddToBootstrapClassLoaderSearch */
659
660
661 // segment - pre-checked for NULL
662 jvmtiError
663 JvmtiEnv::AddToSystemClassLoaderSearch(const char* segment) {
664 jvmtiPhase phase = get_phase();
665
666 if (phase == JVMTI_PHASE_ONLOAD) {
667 for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
668 if (strcmp("java.class.path", p->key()) == 0) {
669 p->append_value(segment);
670 break;
671 }
672 }
|
632 } else if (phase == JVMTI_PHASE_LIVE) {
633 // The phase is checked by the wrapper that called this function,
634 // but this thread could be racing with the thread that is
635 // terminating the VM so we check one more time.
636
637 // create the zip entry
638 ClassPathZipEntry* zip_entry = ClassLoader::create_class_path_zip_entry(segment, true);
639 if (zip_entry == NULL) {
640 return JVMTI_ERROR_ILLEGAL_ARGUMENT;
641 }
642
643 // lock the loader
644 Thread* thread = Thread::current();
645 HandleMark hm;
646 Handle loader_lock = Handle(thread, SystemDictionary::system_loader_lock());
647
648 ObjectLocker ol(loader_lock, thread);
649
650 // add the jar file to the bootclasspath
651 log_info(class, load)("opened: %s", zip_entry->name());
652 #if INCLUDE_CDS
653 ClassLoaderExt::append_boot_classpath(zip_entry);
654 #else
655 ClassLoader::add_to_boot_append_entries(zip_entry);
656 #endif
657 return JVMTI_ERROR_NONE;
658 } else {
659 return JVMTI_ERROR_WRONG_PHASE;
660 }
661
662 } /* end AddToBootstrapClassLoaderSearch */
663
664
665 // segment - pre-checked for NULL
666 jvmtiError
667 JvmtiEnv::AddToSystemClassLoaderSearch(const char* segment) {
668 jvmtiPhase phase = get_phase();
669
670 if (phase == JVMTI_PHASE_ONLOAD) {
671 for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
672 if (strcmp("java.class.path", p->key()) == 0) {
673 p->append_value(segment);
674 break;
675 }
676 }
|