Mercurial Hosting > luan
comparison src/goodjava/io/FileClassLoader.java @ 1844:9147ce7f5b72 default tip
FileClassLoader use SoftCacheMap
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 02 Feb 2025 04:55:02 -0700 |
parents | 22f73129eb4a |
children |
comparison
equal
deleted
inserted
replaced
1843:833096ee8c89 | 1844:9147ce7f5b72 |
---|---|
8 import java.net.URLClassLoader; | 8 import java.net.URLClassLoader; |
9 import java.net.MalformedURLException; | 9 import java.net.MalformedURLException; |
10 import java.util.List; | 10 import java.util.List; |
11 import java.util.ArrayList; | 11 import java.util.ArrayList; |
12 import java.util.Map; | 12 import java.util.Map; |
13 import java.util.HashMap; | 13 import goodjava.util.SoftCacheMap; |
14 | 14 |
15 | 15 |
16 public class FileClassLoader extends URLClassLoader { | 16 public class FileClassLoader extends URLClassLoader { |
17 | 17 |
18 public static final class FileInfo { | 18 public static final class FileInfo { |
58 | 58 |
59 public List<FileInfo> getFiles() { | 59 public List<FileInfo> getFiles() { |
60 return new ArrayList<FileInfo>(files); | 60 return new ArrayList<FileInfo>(files); |
61 } | 61 } |
62 | 62 |
63 private static final Map<List<FileInfo>,FileClassLoader> map = new HashMap<List<FileInfo>,FileClassLoader>(); | 63 private static final Map<List<FileInfo>,FileClassLoader> map = new SoftCacheMap<List<FileInfo>,FileClassLoader>(); |
64 | 64 |
65 public static synchronized FileClassLoader getFileClassLoader(List<FileInfo> files) { | 65 public static synchronized FileClassLoader getFileClassLoader(List<FileInfo> files) { |
66 FileClassLoader fcl = map.get(files); | 66 FileClassLoader fcl = map.get(files); |
67 if( fcl == null ) { | 67 if( fcl == null ) { |
68 fcl = new FileClassLoader(files); | 68 fcl = new FileClassLoader(files); |