Code example for SoftReference

Methods: clear

0
 
    /** 
     * Discards the cache for all threads. 
     */ 
    public void remove() { 
        storage.clear();
    } 
 
    public static ThreadLocalCache<CharsetDecoder> utf8Decoder = new ThreadLocalCache<CharsetDecoder>() {
        protected CharsetDecoder initialValue() { 
            return Charset.forName("UTF-8").newDecoder(); 
        } 
    }; 
 
    public static ThreadLocalCache<CharsetEncoder> utf8Encoder = new ThreadLocalCache<CharsetEncoder>() {
        protected CharsetEncoder initialValue() { 
            return Charset.forName("UTF-8").newEncoder(); 
        } 
    }; 
 
    public static ThreadLocalCache<java.nio.ByteBuffer> byteBuffer = new ThreadLocalCache<java.nio.ByteBuffer>() {