Skip to content

Commit 020ddcf

Browse files
committed
using the framework correctly for indexer
1 parent 1981acb commit 020ddcf

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerFramework.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ protected void classLoaded(AnalyzersInfo localInfo, IAnalyzerPlugin plugin) {
189189
if (analyzer.getName() != null && !analyzer.getName().isEmpty()) {
190190
localInfo.fileTypeDescriptions.put(analyzer.getAnalyzer().getFileTypeName(), analyzer.getName());
191191
}
192+
193+
LOGGER.log(Level.INFO, "An analyzer factory {0} has been loaded.", analyzer.getClass().getCanonicalName());
192194
}
193195

194196
/**

opengrok-indexer/src/main/java/org/opengrok/indexer/framework/PluginClassLoader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import java.io.IOException;
2929
import java.io.InputStream;
3030
import java.util.Arrays;
31-
import java.util.HashMap;
3231
import java.util.Map;
32+
import java.util.concurrent.ConcurrentHashMap;
3333
import java.util.jar.JarEntry;
3434
import java.util.jar.JarFile;
3535
import java.util.logging.Level;
@@ -44,7 +44,7 @@
4444
public class PluginClassLoader extends ClassLoader {
4545

4646
@SuppressWarnings("rawtypes")
47-
private final Map<String, Class> cache = new HashMap<>();
47+
private final Map<String, Class> cache = new ConcurrentHashMap<>();
4848

4949
private static final Logger LOGGER = LoggerFactory.getLogger(PluginClassLoader.class);
5050
private static final String[] CLASS_WHITELIST = new String[]{
@@ -232,8 +232,6 @@ public Class loadClass(String name, boolean resolveIt) throws ClassNotFoundExcep
232232
return c;
233233
}
234234

235-
checkClassname(name);
236-
237235
// find already loaded class
238236
if ((c = findLoadedClass(name)) != null) {
239237
cache.put(name, c);
@@ -257,6 +255,8 @@ public Class loadClass(String name, boolean resolveIt) throws ClassNotFoundExcep
257255
}
258256
}
259257

258+
checkClassname(name);
259+
260260
try {
261261
checkPackage(name);
262262
// load it from file

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ private void initialize() throws IOException {
317317
indexDirectory = FSDirectory.open(indexDir.toPath(), lockfact);
318318
ignoredNames = env.getIgnoredNames();
319319
includedNames = env.getIncludedNames();
320-
analyzerGuru = new AnalyzerGuru();
320+
analyzerGuru = env.getAnalyzerGuru();
321321
xrefDir = new File(env.getDataRootFile(), XREF_DIR);
322322
listeners = new CopyOnWriteArrayList<>();
323323
dirtyFile = new File(indexDir, "dirty");

0 commit comments

Comments
 (0)