Maps Java objects to their proxies. Combines elements of WeakHashMap and ConcurrentHashMap to permit unsynchronized reads. May be configured to use either Weak (the default) or Soft references.
Note that both Java objects and their proxies are held by weak/soft references; because proxies (currently) keep strong references to their Java objects, if we kept strong references to them the Java objects would never be gc'ed. This presents a problem in the case where a user passes a Rubified Java object out to Java but keeps no reference in Ruby to the proxy; if the object is returned to Ruby after its proxy has been gc'ed, a new (and possibly very wrong, in the case of JRuby-defined subclasses) proxy will be created. Use of soft references may help reduce the likelihood of this occurring; users may be advised to keep Ruby-side references to prevent it occurring altogether.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| private static interface | |
| public static enum | |
| pack-priv static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static int | |
| private static final float | |
| private static final int | |
| private static final int | |
| private final int | |
| private static final Logger | |
| private static final int | |
| private static final int | |
| private final ObjectProxyCache. | |
| private final int | |
| private final ObjectProxyCache. | |
| private final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract T | |
| public T | |
| public T | |
| private static int | |
| private static synchronized int | |
| public void | |
| private ObjectProxyCache. | |
| public int | |
| public String |
| _nextId | back to summary |
|---|---|
| private static int _nextId | |
| DEFAULT_LOAD_FACTOR | back to summary |
|---|---|
| private static final float DEFAULT_LOAD_FACTOR | |
| DEFAULT_SEGMENT_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_SEGMENT_SIZE | |
| DEFAULT_SEGMENTS | back to summary |
|---|---|
| private static final int DEFAULT_SEGMENTS | |
| id | back to summary |
|---|---|
| private final int id | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| MAX_CAPACITY | back to summary |
|---|---|
| private static final int MAX_CAPACITY | |
| MAX_SEGMENTS | back to summary |
|---|---|
| private static final int MAX_SEGMENTS | |
| referenceType | back to summary |
|---|---|
| private final ObjectProxyCache. | |
| segmentMask | back to summary |
|---|---|
| private final int segmentMask | |
| segments | back to summary |
|---|---|
| private final ObjectProxyCache. | |
| segmentShift | back to summary |
|---|---|
| private final int segmentShift | |
| VULTURE_RUN_FREQ_SECONDS | back to summary |
|---|---|
| private static final int VULTURE_RUN_FREQ_SECONDS | |
| ObjectProxyCache | back to summary |
|---|---|
| public ObjectProxyCache() | |
| ObjectProxyCache | back to summary |
|---|---|
| public ObjectProxyCache(ObjectProxyCache. | |
| ObjectProxyCache | back to summary |
|---|---|
| public ObjectProxyCache(int numSegments, int initialSegCapacity, ObjectProxyCache. | |
| allocateProxy | back to summary |
|---|---|
| public abstract T allocateProxy(Object javaObject, A allocator) | |
| get | back to summary |
|---|---|
| public T get(Object javaObject) | |
| getOrCreate | back to summary |
|---|---|
| public T getOrCreate(Object javaObject, A allocator) | |
| hash | back to summary |
|---|---|
| private static int hash(Object javaObject) | |
| nextId | back to summary |
|---|---|
| private static synchronized int nextId() | |
| put | back to summary |
|---|---|
| public void put(Object javaObject, T proxy) | |
| segmentFor | back to summary |
|---|---|
| private ObjectProxyCache. | |
| size | back to summary |
|---|---|
| public int size() Returns the approximate size (elements in use) of the cache. The sizes of the segments are summed. No effort is made to synchronize across segments, so the value returned may differ from the actual size at any point in time. | |
| stats | back to summary |
|---|---|
| public String stats() | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final int | |
| pack-priv final ObjectProxyCache. | |
| pack-priv final ObjectProxyCache. | |
| pack-priv final ObjectProxyCache. |
| Access | Constructor and Description |
|---|---|
| pack-priv | Entry(Object object, int hash, T proxy, ObjectProxyCache.
|
| pack-priv | Entry(ObjectProxyCache.
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static final <T> ObjectProxyCache. |
| hash | back to summary |
|---|---|
| pack-priv final int hash | |
| next | back to summary |
|---|---|
| pack-priv final ObjectProxyCache. | |
| objectRef | back to summary |
|---|---|
| pack-priv final ObjectProxyCache. | |
| proxyRef | back to summary |
|---|---|
| pack-priv final ObjectProxyCache. | |
| Entry | back to summary |
|---|---|
| pack-priv Entry(Object object, int hash, T proxy, ObjectProxyCache. | |
| Entry | back to summary |
|---|---|
| pack-priv Entry(ObjectProxyCache. | |
| newArray | back to summary |
|---|---|
pack-priv static final <T> ObjectProxyCache.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final ObjectProxyCache. | |
| public static final ObjectProxyCache. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ObjectProxyCache. | |
| public static ObjectProxyCache. |
| SOFT | back to summary |
|---|---|
| public static final ObjectProxyCache. | |
| WEAK | back to summary |
|---|---|
| public static final ObjectProxyCache. | |
| ReferenceType | back to summary |
|---|---|
| private ReferenceType() | |
| valueOf | back to summary |
|---|---|
| public static ObjectProxyCache. | |
| values | back to summary |
|---|---|
| public static ObjectProxyCache. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ObjectProxyCache | |
| pack-priv volatile ObjectProxyCache. | |
| pack-priv final ReferenceQueue | |
| pack-priv int | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| private void | |
| pack-priv T | |
| pack-priv T | |
| pack-priv static final <T, A> ObjectProxyCache. | |
| pack-priv void | |
| private ObjectProxyCache. | |
| private void |
| cache | back to summary |
|---|---|
| pack-priv final ObjectProxyCache<T, A> cache | |
| entryTable | back to summary |
|---|---|
| pack-priv volatile ObjectProxyCache. | |
| referenceQueue | back to summary |
|---|---|
| pack-priv final ReferenceQueue<Object> referenceQueue | |
| tableSize | back to summary |
|---|---|
| pack-priv int tableSize | |
| threshold | back to summary |
|---|---|
| pack-priv int threshold | |
| Segment | back to summary |
|---|---|
| pack-priv Segment(int capacity, ObjectProxyCache<T, A> cache) | |
| count | back to summary |
|---|---|
| private int count() | |
| expunge | back to summary |
|---|---|
| private void expunge() | |
| get | back to summary |
|---|---|
| pack-priv T get(Object object, int hash) | |
| getOrCreate | back to summary |
|---|---|
| pack-priv T getOrCreate(Object object, int hash, A allocator) | |
| newArray | back to summary |
|---|---|
pack-priv static final <T, A> ObjectProxyCache.
| |
| put | back to summary |
|---|---|
| pack-priv void put(Object object, int hash, T proxy) | |
| rehash | back to summary |
|---|---|
| private ObjectProxyCache. | |
| remove | back to summary |
|---|---|
| private void remove(ObjectProxyCache. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int |
| hash | back to summary |
|---|---|
| pack-priv final int hash | |
| SoftEntryRef | back to summary |
|---|---|
| pack-priv SoftEntryRef(int hash, T rawObject, ReferenceQueue<Object> queue) | |
| hash | back to summary |
|---|---|
| public int hash() Implements org. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int |
| hash | back to summary |
|---|---|
| pack-priv final int hash | |
| WeakEntryRef | back to summary |
|---|---|
| pack-priv WeakEntryRef(int hash, T rawObject, ReferenceQueue<Object> queue) | |
| hash | back to summary |
|---|---|
| public int hash() Implements org. | |