/**
  * Wrapper for close of ResultSet which removes this result set from being traced then calls close
  * on the original ResultSet.
  */
 @Override
 public void close() throws SQLException {
   try {
     if (_stmt != null) {
       ((AbandonedTrace) _stmt).removeTrace(this);
       _stmt = null;
     }
     if (_conn != null) {
       ((AbandonedTrace) _conn).removeTrace(this);
       _conn = null;
     }
     _res.close();
   } catch (SQLException e) {
     handleException(e);
   }
 }
 /**
  * Remove a child object this object is tracing.
  *
  * @param trace AbandonedTrace object to remove
  */
 protected void removeTrace(AbandonedTrace trace) {
   synchronized (this.traceList) {
     Iterator<WeakReference<AbandonedTrace>> iter = traceList.iterator();
     while (iter.hasNext()) {
       WeakReference<AbandonedTrace> ref = iter.next();
       if (trace.equals(ref.get())) {
         iter.remove();
         break;
       } else if (ref.get() == null) {
         // Clean-up since we are here anyway
         iter.remove();
       }
     }
   }
 }
 /**
  * Initialize abandoned tracing for this object.
  *
  * @param parent AbandonedTrace parent object
  */
 private void init(AbandonedTrace parent) {
   if (parent != null) {
     parent.addTrace(this);
   }
 }