public void put(Object javaObject, T proxy) { if (javaObject == null || proxy == null) return; int hash = hash(javaObject); segmentFor(hash).put(javaObject, hash, proxy); }
public T get(Object javaObject) { if (javaObject == null) return null; int hash = hash(javaObject); return segmentFor(hash).get(javaObject, hash); }
public T getOrCreate(Object javaObject, A allocator) { if (javaObject == null || allocator == null) return null; int hash = hash(javaObject); return segmentFor(hash).getOrCreate(javaObject, hash, allocator); }
Entry(Object object, int hash, T proxy, ReferenceType type, Entry<T> next, ReferenceQueue<Object> queue) { this.hash = hash; this.next = next; // references to the Java object and its proxy will either both be // weak or both be soft, since the proxy contains a strong reference // to the object, so it wouldn't make sense for the reference types // to differ. if (type == ReferenceType.WEAK) { this.objectRef = new WeakEntryRef<Object>(hash, object, queue); this.proxyRef = new WeakEntryRef<T>(hash, proxy, queue); } else { this.objectRef = new SoftEntryRef<Object>(hash, object, queue); this.proxyRef = new SoftEntryRef<T>(hash, proxy, queue); } }
Segment(int capacity, ObjectProxyCache<T,A> cache) { threshold = (int)(capacity * DEFAULT_LOAD_FACTOR); entryTable = Entry.newArray(capacity); this.cache = cache; }
public void put(Object javaObject, T proxy) { if (javaObject == null || proxy == null) return; int hash = hash(javaObject); segmentFor(hash).put(javaObject, hash, proxy); }
public T get(Object javaObject) { if (javaObject == null) return null; int hash = hash(javaObject); return segmentFor(hash).get(javaObject, hash); }
public T getOrCreate(Object javaObject, A allocator) { if (javaObject == null || allocator == null) return null; int hash = hash(javaObject); return segmentFor(hash).getOrCreate(javaObject, hash, allocator); }
Entry(Object object, int hash, T proxy, ReferenceType type, Entry<T> next, ReferenceQueue<Object> queue) { this.hash = hash; this.next = next; // references to the Java object and its proxy will either both be // weak or both be soft, since the proxy contains a strong reference // to the object, so it wouldn't make sense for the reference types // to differ. if (type == ReferenceType.WEAK) { this.objectRef = new WeakEntryRef<Object>(hash, object, queue); this.proxyRef = new WeakEntryRef<T>(hash, proxy, queue); } else { this.objectRef = new SoftEntryRef<Object>(hash, object, queue); this.proxyRef = new SoftEntryRef<T>(hash, proxy, queue); } }
Segment(int capacity, ObjectProxyCache<T,A> cache) { threshold = (int)(capacity * DEFAULT_LOAD_FACTOR); entryTable = Entry.newArray(capacity); this.cache = cache; }
public void put(Object javaObject, T proxy) { if (javaObject == null || proxy == null) return; int hash = hash(javaObject); segmentFor(hash).put(javaObject, hash, proxy); }
public T get(Object javaObject) { if (javaObject == null) return null; int hash = hash(javaObject); return segmentFor(hash).get(javaObject, hash); }
public T getOrCreate(Object javaObject, A allocator) { if (javaObject == null || allocator == null) return null; int hash = hash(javaObject); return segmentFor(hash).getOrCreate(javaObject, hash, allocator); }
public void put(Object javaObject, T proxy) { if (javaObject == null || proxy == null) return; int hash = hash(javaObject); segmentFor(hash).put(javaObject, hash, proxy); }
public T get(Object javaObject) { if (javaObject == null) return null; int hash = hash(javaObject); return segmentFor(hash).get(javaObject, hash); }
public T getOrCreate(Object javaObject, A allocator) { if (javaObject == null || allocator == null) return null; int hash = hash(javaObject); return segmentFor(hash).getOrCreate(javaObject, hash, allocator); }