-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initial version of MavenClassLoader
- Loading branch information
1 parent
30e4c35
commit e340fb0
Showing
3 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
core/src/main/java/lucee/commons/io/res/util/MavenClassLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package lucee.commons.io.res.util; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
import lucee.runtime.mvn.POM; | ||
|
||
public class MavenClassLoader extends ResourceClassLoader { | ||
|
||
private static Map<String, MavenClassLoader> instances = new ConcurrentHashMap<>(); | ||
|
||
public MavenClassLoader(POM pom, ClassLoader parent) throws IOException { | ||
super(pom.getJars(), parent); | ||
} | ||
|
||
public static MavenClassLoader getInstance(POM pom, ClassLoader parent) throws IOException { | ||
MavenClassLoader mcl = instances.get(pom.hash()); | ||
if (mcl == null) { | ||
mcl = new MavenClassLoader(pom, parent); | ||
instances.put(pom.hash(), mcl); | ||
} | ||
return mcl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters