Ejemplo n.º 1
0
 @Override
 public void close() throws SQLException {
   try {
     ConnectionTracker.removeConnection(this.connection);
   } catch (Throwable t) {
     // do not want to fail just for tracking logic as this could cause connection leaks
     LOG.error("could not remove connection from tracking", t);
   } finally {
     this.connection.close();
   }
 }
Ejemplo n.º 2
0
  /** wraps a connection. */
  public TrackingConnection(Connection connection) {
    if (connection == null) {
      throw new IllegalArgumentException("the connection was null");
    }

    try {
      ConnectionTracker.addConnection(connection);
    } catch (Throwable t) {
      // do not want to fail just for tracking logic as this could cause connection leaks
      LOG.error("could not add connection for tracking", t);
    } finally {
      this.connection = connection;
    }
  }