diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-25 16:48:28 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-01 23:10:48 -0500 |
commit | 00d9485f5597fdecc58461bd81df635fafbe494f (patch) | |
tree | 026f7f143d8cf5ae69e7afaa452d03180d3e04a8 /nailgun_launcher/ClassLoaderCache2.java | |
parent | 8939ebef01ae7a665781d99331e4d13e7b875a96 (diff) | |
download | cbt-00d9485f5597fdecc58461bd81df635fafbe494f.tar.gz cbt-00d9485f5597fdecc58461bd81df635fafbe494f.tar.bz2 cbt-00d9485f5597fdecc58461bd81df635fafbe494f.zip |
Merge separate hashmaps for persistent cache into one
This isn’t type-safe, but re-using that same hashmap for both keys and
classloaders allows to reduce the number of members in Context. Also
we can re-use the same hashMap for other things as well in the coming
commits, e.g. timestamps.
Diffstat (limited to 'nailgun_launcher/ClassLoaderCache2.java')
-rw-r--r-- | nailgun_launcher/ClassLoaderCache2.java | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/nailgun_launcher/ClassLoaderCache2.java b/nailgun_launcher/ClassLoaderCache2.java deleted file mode 100644 index bf9ca3b..0000000 --- a/nailgun_launcher/ClassLoaderCache2.java +++ /dev/null @@ -1,37 +0,0 @@ -package cbt; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import static java.io.File.pathSeparator; -import static cbt.Stage0Lib.*; - -final class ClassLoaderCache2<T>{ - ConcurrentHashMap<String,Object> keys; - ConcurrentHashMap<Object,T> values; - - public ClassLoaderCache2( - ConcurrentHashMap<String,Object> keys, - ConcurrentHashMap<Object,T> values - ){ - this.keys = keys; - this.values = values; - } - - public T get( String key ){ - return values.get( - keys.get( key ) - ); - } - - public Boolean contains( String key ){ - return keys.containsKey( key ); - } - - public T put( T value, String key ){ - LockableKey2 keyObject = new LockableKey2(); - keys.put( key, keyObject ); - values.put( keyObject, value ); - return value; - } -} -class LockableKey2{}
\ No newline at end of file |