Module 
Package org.xnio

Class AutomaticReference<T>


  • @Deprecated
    public abstract class AutomaticReference<T>
    extends java.lang.ref.PhantomReference<T>
    Deprecated.
    See CleanerReference.
    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

      Constructors 
      Modifier Constructor Description
      protected AutomaticReference​(T referent, java.lang.Object permit)
      Deprecated.
      Construct a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void clear()
      Deprecated.
      Not supported.
      boolean enqueue()
      Deprecated.
      Not supported.
      protected abstract void free()
      Deprecated.
      Free this reference.
      T get()
      Deprecated.
      Always returns null.
      static java.lang.Object getPermit()
      Deprecated.
      Get the security authorization permit to create automatic references.
      boolean isEnqueued()
      Deprecated.
      Determine whether this reference has been enqueued by the garbage collector.
      • Methods inherited from class java.lang.ref.Reference

        clone, reachabilityFence
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AutomaticReference

        protected AutomaticReference​(T referent,
                                     java.lang.Object permit)
        Deprecated.
        Construct a new instance. In order to maximize performance, the only security check performed by this constructor is to verify the permit which was passed in.
        Parameters:
        referent - the object to monitor
        permit - the permit object originally acquired from getPermit()
    • Method Detail

      • getPermit

        public static java.lang.Object getPermit()
        Deprecated.
        Get the security authorization permit to create automatic references.
        Returns:
        the permit
        Throws:
        java.lang.SecurityException - if a security manager is enabled and the caller does not have the createAutomaticReference RuntimePermission
      • get

        public final T get()
        Deprecated.
        Always returns null.
        Overrides:
        get in class java.lang.ref.PhantomReference<T>
        Returns:
        null
      • clear

        public final void clear()
        Deprecated.
        Not supported.
        Overrides:
        clear in class java.lang.ref.Reference<T>
        Throws:
        java.lang.UnsupportedOperationException - always
      • isEnqueued

        public final boolean isEnqueued()
        Deprecated.
        Determine whether this reference has been enqueued by the garbage collector.
        Overrides:
        isEnqueued in class java.lang.ref.Reference<T>
        Returns:
        true if the reference has been enqueued, false otherwise
      • enqueue

        public final boolean enqueue()
        Deprecated.
        Not supported.
        Overrides:
        enqueue in class java.lang.ref.Reference<T>
        Returns:
        nothing
        Throws:
        java.lang.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.