Skip to content

Commit

Permalink
reduce the trials on loading a ClassExtensionLibrary
Browse files Browse the repository at this point in the history
mkristian committed May 27, 2015
1 parent 7d38c5f commit ee76b6f
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions core/src/main/java/org/jruby/runtime/load/LibrarySearcher.java
Original file line number Diff line number Diff line change
@@ -60,19 +60,9 @@ public FoundLibrary findBySearchState(LoadService.SearchState state) {
}

public FoundLibrary findLibrary(String baseName, SuffixType suffixType) {
boolean searchedForServiceLibrary = false;

for (String suffix : suffixType.getSuffixes()) {
FoundLibrary library = findBuiltinLibrary(baseName, suffix);
if (library == null) library = findResourceLibrary(baseName, suffix);

// Since searching for a service library doesn't take the suffix into account, there's no need
// to perform it more than once.
if (library == null && !searchedForServiceLibrary) {
library = findServiceLibrary(baseName, suffix);
searchedForServiceLibrary = true;
}

if (library != null) {
return library;
}
@@ -94,17 +84,6 @@ private FoundLibrary findBuiltinLibrary(String name, String suffix) {
return null;
}

private FoundLibrary findServiceLibrary(String name, String ignored) {
DebugLog.JarExtension.logTry(name);
Library extensionLibrary = ClassExtensionLibrary.tryFind(runtime, name);
if (extensionLibrary != null) {
DebugLog.JarExtension.logFound(name);
return new FoundLibrary(extensionLibrary, name);
} else {
return null;
}
}

private FoundLibrary findResourceLibrary(String baseName, String suffix) {
if (baseName.startsWith("./")) {
return findFileResource(baseName, suffix);

0 comments on commit ee76b6f

Please sign in to comment.