public ReferenceCache(Type keyType, Type valueType, int initialSize) { this.keyFactory = toFactory(keyType); this.valueFactory = toFactory(valueType); this.lookupFactory = new StrongReferenceFactory(); this.cache = new ConcurrentHashMap<ReferenceKey<K>,Future<ReferenceValue<V>>>(initialSize); this.queue = new ReferenceQueueRunner(); Thread t = new Thread(this.queue); t.setDaemon(true); t.start(); }
private final ReferenceFactory<K,V> toFactory(Type type) { switch (type) { case Strong : return new StrongReferenceFactory(); case Weak : return new WeakReferenceFactory(); case Soft : return new SoftReferenceFactory(); default : throw new IllegalArgumentException("Invalid ReferenceType: " + type); } }
private final ReferenceFactory<K,V> toFactory(Type type) { switch (type) { case Strong : return new StrongReferenceFactory(); case Weak : return new WeakReferenceFactory(); case Soft : return new SoftReferenceFactory(); default : throw new IllegalArgumentException("Invalid ReferenceType: " + type); } }
public ReferenceCache(Type keyType, Type valueType, int initialSize) { this.keyFactory = toFactory(keyType); this.valueFactory = toFactory(valueType); this.lookupFactory = new StrongReferenceFactory(); this.cache = new ConcurrentHashMap<ReferenceKey<K>, ReferenceValue<V>>(initialSize); this.queue = new ReferenceQueueRunner(); }
private final ReferenceFactory<K,V> toFactory(Type type) { switch (type) { case Strong : return new StrongReferenceFactory(); case Weak : return new WeakReferenceFactory(); case Soft : return new SoftReferenceFactory(); default : throw new IllegalArgumentException("Invalid ReferenceType: " + type); } }
public ReferenceCache(Type keyType, Type valueType, int initialSize) { this.keyFactory = toFactory(keyType); this.valueFactory = toFactory(valueType); this.lookupFactory = new StrongReferenceFactory(); this.cache = new ConcurrentHashMap<ReferenceKey<K>, ReferenceValue<V>>(initialSize); this.queue = new ReferenceQueueRunner(); }