@@ -82,20 +82,34 @@ void ClassLoaderExt::setup_app_search_path(JavaThread* current) {
82
82
83
83
void ClassLoaderExt::process_module_table (JavaThread* current, ModuleEntryTable* met) {
84
84
ResourceMark rm (current);
85
- class Process : public ModuleClosure {
85
+ GrowableArray<char *>* module_paths = new GrowableArray<char *>(5 );
86
+
87
+ class ModulePathsGatherer : public ModuleClosure {
86
88
JavaThread* _current;
89
+ GrowableArray<char *>* _module_paths;
87
90
public:
88
- Process (JavaThread* current) : _current(current) {}
91
+ ModulePathsGatherer (JavaThread* current, GrowableArray<char *>* module_paths) :
92
+ _current (current), _module_paths(module_paths) {}
89
93
void do_module (ModuleEntry* m) {
90
94
char * path = m->location ()->as_C_string ();
91
95
if (strncmp (path, " file:" , 5 ) == 0 ) {
92
96
path = ClassLoader::skip_uri_protocol (path);
93
- ClassLoader::setup_module_search_path (_current, path);
97
+ char * path_copy = NEW_RESOURCE_ARRAY (char , strlen (path) + 1 );
98
+ strcpy (path_copy, path);
99
+ _module_paths->append (path_copy);
94
100
}
95
101
}
96
102
};
97
- Process process (current);
98
- met->modules_do (&process);
103
+
104
+ ModulePathsGatherer gatherer (current, module_paths);
105
+ {
106
+ MutexLocker ml (Module_lock);
107
+ met->modules_do (&gatherer);
108
+ }
109
+
110
+ for (int i = 0 ; i < module_paths->length (); i++) {
111
+ ClassLoader::setup_module_search_path (current, module_paths->at (i));
112
+ }
99
113
}
100
114
101
115
void ClassLoaderExt::setup_module_paths (JavaThread* current) {
0 commit comments