public void enableConnectionGC() throws IllegalStateException {
  if (refQueue != null) {
    throw new IllegalStateException("Connection GC already enabled.");
  }
  poolLock.lock();
  try {
    if (numConnections > 0) {
      throw new IllegalStateException("Pool already in use.");
    }
  }
  finally {
    poolLock.unlock();
  }
  refQueue=new ReferenceQueue<Object>();
  refWorker=new RefQueueWorker(refQueue,this);
  Thread t=new Thread(refWorker);
  t.setDaemon(true);
  t.setName("RefQueueWorker@" + this);
  t.start();
}

public void enableConnectionGC ( ) throws IllegalStateException { if ( refQueue != null ) { throw new IllegalStateException ( "Connection GC already enabled." ) ; } poolLock . lock ( ) ; try { if ( numConnections > 0 ) { throw new IllegalStateException ( "Pool already in use." ) ; } } finally { poolLock . unlock ( ) ; } refQueue = new ReferenceQueue < Object > ( ) ; refWorker = new RefQueueWorker ( refQueue , this ) ; Thread t = new Thread ( refWorker ) ; t . setDaemon ( true ) ; t . setName ( "RefQueueWorker@" + this ) ; t . start ( ) ; }
enables connection garbage collection ( gc ) . this method must be called immediately after creating the connection pool . it is not possible to enable connection gc after pool entries have been created . neither is it possible to disable connection gc .
