src/share/classes/com/sun/jndi/ldap/pool/ConnectionsWeakRef.java

Print this page




  38  *        -------> Connections -----> ConnectionDesc
  39  *        |              ^                  |
  40  *        |              |                  |
  41  *        |              |                  |
  42  * ConnectionsRef    LdapClient <------------
  43  *        ^              |   ^
  44  *        :              |   |
  45  *        :              v   |
  46  * ConnectionsWeakRef  Connection
  47  *
  48  * The ConnectionsRef is for cleaning up the resources held by the
  49  * Connection thread by making them available to the GC. The pool
  50  * uses ConnectionRef to hold the pooled resources.
  51  *
  52  * This class in turn holds a WeakReference with a ReferenceQueue to the
  53  * ConnectionRef to track when the ConnectionRef becomes ready
  54  * for getting GC'ed. It extends from WeakReference in order to hold a
  55  * reference to Connections used for closing (which in turn terminates
  56  * the Connection thread) it by monitoring the ReferenceQueue.
  57  */
  58 class ConnectionsWeakRef extends WeakReference {
  59 
  60     private final Connections conns;
  61 
  62     ConnectionsWeakRef (ConnectionsRef connsRef, ReferenceQueue queue) {

  63         super(connsRef, queue);
  64         this.conns = connsRef.getConnections();
  65     }
  66 
  67     Connections getConnections() {
  68         return conns;
  69     }
  70 }


  38  *        -------> Connections -----> ConnectionDesc
  39  *        |              ^                  |
  40  *        |              |                  |
  41  *        |              |                  |
  42  * ConnectionsRef    LdapClient <------------
  43  *        ^              |   ^
  44  *        :              |   |
  45  *        :              v   |
  46  * ConnectionsWeakRef  Connection
  47  *
  48  * The ConnectionsRef is for cleaning up the resources held by the
  49  * Connection thread by making them available to the GC. The pool
  50  * uses ConnectionRef to hold the pooled resources.
  51  *
  52  * This class in turn holds a WeakReference with a ReferenceQueue to the
  53  * ConnectionRef to track when the ConnectionRef becomes ready
  54  * for getting GC'ed. It extends from WeakReference in order to hold a
  55  * reference to Connections used for closing (which in turn terminates
  56  * the Connection thread) it by monitoring the ReferenceQueue.
  57  */
  58 class ConnectionsWeakRef extends WeakReference<ConnectionsRef> {
  59 
  60     private final Connections conns;
  61 
  62     ConnectionsWeakRef (ConnectionsRef connsRef,
  63                         ReferenceQueue<? super ConnectionsRef> queue) {
  64         super(connsRef, queue);
  65         this.conns = connsRef.getConnections();
  66     }
  67 
  68     Connections getConnections() {
  69         return conns;
  70     }
  71 }