private V dereferenceValue(Future<ReferenceValue<V>> futureValue) { try { return futureValue == null ? null : dereferenceValue(futureValue.get()); } catch (Exception e) { return null; } }
public V remove(Object key) { ReferenceKey<K> keyRef = this.lookupFactory.createKey(this.queue, key); return this.dereferenceValue(this.cache.remove(keyRef)); }
public V remove(Object key) { ReferenceKey<K> keyRef = this.lookupFactory.createKey(this.queue, key); return this.dereferenceValue(this.cache.remove(keyRef)); }
public V remove(Object key) { ReferenceKey<K> keyRef = this.lookupFactory.createKey(this.queue, key); return this.dereferenceValue(this.cache.remove(keyRef)); }
ReferenceKey<K> refKey = this.lookupFactory.createKey(this.queue, (K) key); Future<ReferenceValue<V>> f = this.cache.get(refKey); V value = dereferenceValue(f); if (value != null) { return value; value = dereferenceValue(f); if (value == null) { value = this.create((K) key);
public V get(final Object key) { try { ReferenceKey<K> refKey = this.lookupFactory.createKey(this.queue, (K) key); ReferenceValue<V> refVal = this.cache.get(refKey); V value = dereferenceValue(refVal); if (value != null) { return value; } else { V created = create((K) key); refVal = valueFactory.createValue(queue, created); refKey = this.keyFactory.createKey(this.queue, (K) key); refVal = this.cache.putIfAbsent(refKey, refVal); value = dereferenceValue(refVal); if (value == null) { value = this.create((K) key); this.put((K) key, value); } return value; } } catch (Exception e) { if (e instanceof RuntimeException) throw (RuntimeException) e; throw new IllegalStateException(e); } }
public V get(final Object key) { try { ReferenceKey<K> refKey = this.lookupFactory.createKey(this.queue, (K) key); ReferenceValue<V> refVal = this.cache.get(refKey); V value = dereferenceValue(refVal); if (value != null) { return value; } else { V created = create((K) key); refVal = valueFactory.createValue(queue, created); refKey = this.keyFactory.createKey(this.queue, (K) key); refVal = this.cache.putIfAbsent(refKey, refVal); value = dereferenceValue(refVal); if (value == null) { value = this.create((K) key); this.put((K) key, value); } return value; } } catch (Exception e) { if (e instanceof RuntimeException) throw (RuntimeException) e; throw new IllegalStateException(e); } }