Révision 3676
TXM/trunk/bundles/org.txm.groovy.core/src/java/org/txm/groovy/core/TXMClassLoader.java (revision 3676) | ||
---|---|---|
74 | 74 |
catch (Exception e) { |
75 | 75 |
} |
76 | 76 |
|
77 |
String p = null; |
|
78 |
int idx = name.lastIndexOf("."); |
|
79 |
if (idx > 0) { |
|
80 |
p = name.substring(0, idx); |
|
81 |
} else { |
|
82 |
p = ""; |
|
83 |
} |
|
84 |
|
|
85 |
if (packageToLoaders != null && packageToLoaders.containsKey(p)) { |
|
86 |
for (EquinoxClassLoader loader : packageToLoaders.get(p)) { |
|
87 |
if (loader != null) { |
|
88 |
Class<?> c = loader.loadClass(name); |
|
89 |
//System.out.println("load from " + loader.getName() + ": " + name); |
|
90 |
return c; |
|
77 |
|
|
78 |
if (packageToLoaders != null) { |
|
79 |
String p = null; |
|
80 |
int idx = name.lastIndexOf("."); |
|
81 |
if (idx > 0) { |
|
82 |
p = name.substring(0, idx); |
|
83 |
} else { |
|
84 |
p = ""; |
|
85 |
} |
|
86 |
|
|
87 |
if (packageToLoaders.containsKey(p)) { |
|
88 |
for (EquinoxClassLoader loader : packageToLoaders.get(p)) { |
|
89 |
if (loader != null) { |
|
90 |
Class<?> c = loader.loadClass(name); |
|
91 |
//System.out.println("load from " + loader.getName() + ": " + name); |
|
92 |
return c; |
|
93 |
} |
|
91 | 94 |
} |
92 | 95 |
} |
93 | 96 |
} |
94 |
|
|
95 | 97 |
//TODO first tests did not boost the class loading |
96 | 98 |
// // try using the class package name |
97 | 99 |
// if (name.startsWith("org.txm.")) { |
... | ... | |
149 | 151 |
// } |
150 | 152 |
// } |
151 | 153 |
|
152 |
// last resort test all loaders |
|
153 |
for (EquinoxClassLoader cl : loaders.values()) { |
|
154 |
|
|
155 |
// FIXME: SJ: tests to speed up this very long process |
|
156 |
// if(cl instanceof EquinoxClassLoader) { |
|
157 |
// EquinoxClassLoader ecl = (EquinoxClassLoader) cl; |
|
158 |
// |
|
159 |
// //Log.finest("TXMClassLoader.findClass(): looking for class " + name + " in bundle " + ecl.getBundle().getSymbolicName()); |
|
160 |
// |
|
161 |
// // FIXME: trying to skip Bundle where Bundle id not matching the class package |
|
162 |
// String pack = name.split("\\$")[0]; |
|
163 |
// if(!ecl.getBundle().getSymbolicName().startsWith(pack)) { |
|
164 |
// // FIXME: SJ: for debugging to speed up the process |
|
165 |
// //Log.finest("TXMClassLoader.findClass(): skipping bundle " + ecl.getBundle().getSymbolicName() + " for class starting with " + pack); |
|
166 |
// continue; |
|
167 |
// } |
|
168 |
// } |
|
169 |
// |
|
170 |
|
|
171 |
try { |
|
172 |
return cl.loadClass(name); |
|
173 |
} |
|
174 |
catch (Exception e) { |
|
175 |
} |
|
176 |
} |
|
154 |
// // last resort test all loaders
|
|
155 |
// for (EquinoxClassLoader cl : loaders.values()) {
|
|
156 |
// |
|
157 |
// // FIXME: SJ: tests to speed up this very long process
|
|
158 |
// // if(cl instanceof EquinoxClassLoader) {
|
|
159 |
// // EquinoxClassLoader ecl = (EquinoxClassLoader) cl;
|
|
160 |
// //
|
|
161 |
// // //Log.finest("TXMClassLoader.findClass(): looking for class " + name + " in bundle " + ecl.getBundle().getSymbolicName());
|
|
162 |
// //
|
|
163 |
// // // FIXME: trying to skip Bundle where Bundle id not matching the class package
|
|
164 |
// // String pack = name.split("\\$")[0];
|
|
165 |
// // if(!ecl.getBundle().getSymbolicName().startsWith(pack)) {
|
|
166 |
// // // FIXME: SJ: for debugging to speed up the process
|
|
167 |
// // //Log.finest("TXMClassLoader.findClass(): skipping bundle " + ecl.getBundle().getSymbolicName() + " for class starting with " + pack);
|
|
168 |
// // continue;
|
|
169 |
// // }
|
|
170 |
// // }
|
|
171 |
// //
|
|
172 |
// |
|
173 |
// try {
|
|
174 |
// return cl.loadClass(name);
|
|
175 |
// }
|
|
176 |
// catch (Exception e) {
|
|
177 |
// }
|
|
178 |
// }
|
|
177 | 179 |
throw new ClassNotFoundException(name); |
178 | 180 |
} |
179 | 181 |
} |
Formats disponibles : Unified diff