equal
deleted
inserted
replaced
141 } |
141 } |
142 |
142 |
143 /* |
143 /* |
144 * system property to disable clearing before enqueuing. |
144 * system property to disable clearing before enqueuing. |
145 */ |
145 */ |
146 private static final boolean disableClearBeforeEnqueue |
146 private static final class ClearBeforeEnqueue { |
147 = Boolean.getBoolean("jdk.lang.ref.disableClearBeforeEnqueue"); |
147 static final boolean DISABLE = |
|
148 Boolean.getBoolean("jdk.lang.ref.disableClearBeforeEnqueue"); |
|
149 } |
148 |
150 |
149 /* |
151 /* |
150 * Atomically get and clear (set to null) the VM's pending list. |
152 * Atomically get and clear (set to null) the VM's pending list. |
151 */ |
153 */ |
152 private static native Reference<Object> getAndClearReferencePendingList(); |
154 private static native Reference<Object> getAndClearReferencePendingList(); |
295 * @return <code>true</code> if this reference object was successfully |
297 * @return <code>true</code> if this reference object was successfully |
296 * enqueued; <code>false</code> if it was already enqueued or if |
298 * enqueued; <code>false</code> if it was already enqueued or if |
297 * it was not registered with a queue when it was created |
299 * it was not registered with a queue when it was created |
298 */ |
300 */ |
299 public boolean enqueue() { |
301 public boolean enqueue() { |
300 if (!disableClearBeforeEnqueue) |
302 if (!ClearBeforeEnqueue.DISABLE) |
301 this.referent = null; |
303 this.referent = null; |
302 return this.queue.enqueue(this); |
304 return this.queue.enqueue(this); |
303 } |
305 } |
304 |
306 |
305 /* -- Constructors -- */ |
307 /* -- Constructors -- */ |