| 74 |
74 |
}
|
| 75 |
75 |
}
|
| 76 |
76 |
// for(String p : packageToLoaders.keySet()) System.out.println(p);
|
| 77 |
|
|
| 78 |
77 |
}
|
| 79 |
78 |
|
| 80 |
79 |
@Override
|
| ... | ... | |
| 91 |
90 |
}
|
| 92 |
91 |
catch (Exception e) {
|
| 93 |
92 |
}
|
| 94 |
|
|
| 95 |
93 |
|
| 96 |
|
if (packageToLoaders != null) {
|
|
94 |
if (packageToLoaders != null) { // fast index enable
|
| 97 |
95 |
//get the package name from the canonical class name
|
| 98 |
96 |
String p = null;
|
| 99 |
97 |
int idx = name.lastIndexOf(".");
|
| ... | ... | |
| 113 |
111 |
}
|
| 114 |
112 |
}
|
| 115 |
113 |
}
|
|
114 |
} else { // no fast index, try with all loaders until one works
|
|
115 |
for (EquinoxClassLoader cl : loaders.values()) {
|
|
116 |
|
|
117 |
// FIXME: SJ: tests to speed up this very long process
|
|
118 |
// if(cl instanceof EquinoxClassLoader) {
|
|
119 |
// EquinoxClassLoader ecl = (EquinoxClassLoader) cl;
|
|
120 |
//
|
|
121 |
// //Log.finest("TXMClassLoader.findClass(): looking for class " + name + " in bundle " + ecl.getBundle().getSymbolicName());
|
|
122 |
//
|
|
123 |
// // FIXME: trying to skip Bundle where Bundle id not matching the class package
|
|
124 |
// String pack = name.split("\\$")[0];
|
|
125 |
// if(!ecl.getBundle().getSymbolicName().startsWith(pack)) {
|
|
126 |
// // FIXME: SJ: for debugging to speed up the process
|
|
127 |
// //Log.finest("TXMClassLoader.findClass(): skipping bundle " + ecl.getBundle().getSymbolicName() + " for class starting with " + pack);
|
|
128 |
// continue;
|
|
129 |
// }
|
|
130 |
// }
|
|
131 |
//
|
|
132 |
|
|
133 |
try {
|
|
134 |
return cl.loadClass(name);
|
|
135 |
}
|
|
136 |
catch (Exception e) { // an exception is raised if class is not found, ignore it and try with the other loaders
|
|
137 |
}
|
|
138 |
}
|
| 116 |
139 |
}
|
| 117 |
140 |
|
| 118 |
141 |
|
| ... | ... | |
| 178 |
201 |
// }
|
| 179 |
202 |
// }
|
| 180 |
203 |
|
| 181 |
|
// // last resort test all loaders
|
| 182 |
|
// for (EquinoxClassLoader cl : loaders.values()) {
|
| 183 |
|
//
|
| 184 |
|
// // FIXME: SJ: tests to speed up this very long process
|
| 185 |
|
// // if(cl instanceof EquinoxClassLoader) {
|
| 186 |
|
// // EquinoxClassLoader ecl = (EquinoxClassLoader) cl;
|
| 187 |
|
// //
|
| 188 |
|
// // //Log.finest("TXMClassLoader.findClass(): looking for class " + name + " in bundle " + ecl.getBundle().getSymbolicName());
|
| 189 |
|
// //
|
| 190 |
|
// // // FIXME: trying to skip Bundle where Bundle id not matching the class package
|
| 191 |
|
// // String pack = name.split("\\$")[0];
|
| 192 |
|
// // if(!ecl.getBundle().getSymbolicName().startsWith(pack)) {
|
| 193 |
|
// // // FIXME: SJ: for debugging to speed up the process
|
| 194 |
|
// // //Log.finest("TXMClassLoader.findClass(): skipping bundle " + ecl.getBundle().getSymbolicName() + " for class starting with " + pack);
|
| 195 |
|
// // continue;
|
| 196 |
|
// // }
|
| 197 |
|
// // }
|
| 198 |
|
// //
|
| 199 |
|
//
|
| 200 |
|
// try {
|
| 201 |
|
// return cl.loadClass(name);
|
| 202 |
|
// }
|
| 203 |
|
// catch (Exception e) {
|
| 204 |
|
// }
|
| 205 |
|
// }
|
|
204 |
|
| 206 |
205 |
throw new ClassNotFoundException(name);
|
| 207 |
206 |
}
|
| 208 |
207 |
}
|