Package org.xnio
Class AutomaticReference<T>
java.lang.Object
java.lang.ref.Reference<T>
java.lang.ref.PhantomReference<T>
org.xnio.AutomaticReference<T>
Deprecated.
An automatic reference is a phantom reference which is automatically freed by a background thread when it is
enqueued. Since this type of garbage collection imposes considerable overhead, it should only be used sparingly,
when it is impossible to achieve correctness any other way.
- Author:
- David M. Lloyd
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AutomaticReference
(T referent, Object permit) Deprecated.Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
clear()
Deprecated.Not supported.final boolean
enqueue()
Deprecated.Not supported.protected abstract void
free()
Deprecated.Free this reference.final T
get()
Deprecated.Always returnsnull
.static Object
Deprecated.Get the security authorization permit to create automatic references.final boolean
Deprecated.Determine whether this reference has been enqueued by the garbage collector.Methods inherited from class java.lang.ref.Reference
clone, reachabilityFence, refersTo
-
Constructor Details
-
AutomaticReference
Deprecated.Construct a new instance. In order to maximize performance, the only security check performed by this constructor is to verify thepermit
which was passed in.- Parameters:
referent
- the object to monitorpermit
- the permit object originally acquired fromgetPermit()
-
-
Method Details
-
getPermit
Deprecated.Get the security authorization permit to create automatic references.- Returns:
- the permit
- Throws:
SecurityException
- if a security manager is enabled and the caller does not have thecreateAutomaticReference
RuntimePermission
-
get
Deprecated.Always returnsnull
.- Overrides:
get
in classPhantomReference<T>
- Returns:
null
-
clear
public final void clear()Deprecated.Not supported.- Overrides:
clear
in classReference<T>
- Throws:
UnsupportedOperationException
- always
-
isEnqueued
public final boolean isEnqueued()Deprecated.Determine whether this reference has been enqueued by the garbage collector.- Overrides:
isEnqueued
in classReference<T>
- Returns:
true
if the reference has been enqueued,false
otherwise
-
enqueue
public final boolean enqueue()Deprecated.Not supported.- Overrides:
enqueue
in classReference<T>
- Returns:
- nothing
- Throws:
UnsupportedOperationException
- always
-
free
protected abstract void free()Deprecated.Free this reference. This method will be called from a dedicated thread or threads so this method should execute as quickly as possible.
-
CleanerReference
.