T
- The type of the referencepublic class FlexReference<T> extends Object
Constructor and Description |
---|
FlexReference(T object,
ReferenceType type)
Holds the passed in object and creates a reference if necessary
|
FlexReference(T object,
ReferenceType type,
ReferenceQueue<? extends T> queue)
Holds the passed in object and creates a reference if necessary
|
Modifier and Type | Method and Description |
---|---|
boolean |
enqueue()
Attempts to insert the reference into the
ReferenceQueue |
T |
get()
Retrieves the current value of the reference
|
boolean |
isEnqueued()
Returns whether or not the object is enqueued.
|
public FlexReference(T object, ReferenceType type)
object
- The object to hold a reference totype
- The type of reference to usepublic FlexReference(T object, ReferenceType type, ReferenceQueue<? extends T> queue)
object
- The object to hold a reference totype
- The type of reference to usequeue
- A backed ReferenceQueue
for any constructed refpublic T get()
null
if the object has been GC'dpublic boolean isEnqueued()
false
true
if the object is not a strong reference and the
reference is enqueuedReference.isEnqueued()
public boolean enqueue()
ReferenceQueue
true
if the object is not a strong reference and the
reference is successfully enqueued for the first timeReference.enqueue()
Copyright © 2015. All rights reserved.