示例#1
0
  /*
   * Closes the connections contained in the ConnectionsRef object that
   * is going to be reclaimed by the GC. Called by getPooledConnection()
   * and expire() methods of this class.
   */
  private static void expungeStaleConnections() {
    ConnectionsWeakRef releaseRef = null;
    while ((releaseRef = (ConnectionsWeakRef) queue.poll()) != null) {
      Connections conns = releaseRef.getConnections();

      if (debug) {
        System.err.println("weak reference cleanup: Closing Connections:" + conns);
      }

      // cleanup
      conns.close();
      weakRefs.remove(releaseRef);
      releaseRef.clear();
    }
  }