Tear down the database handle, freeing any internal
resources.
@param callInfo Call info.
@param closeConn Close underlying connection.
549657
void teardown(CallInfo callInfo, boolean closeConn) {
    logSetup(callInfo);
    if (pool != null) {
      for (WrappedStatement ws : pool.values()) {
        ignoreSQLException(ws.getStatement()::close);
      }
      pool.clear();
      pool = null;
    }
    clearSavePointIfSet();
    log.close();
    log = null;
    if (closeConn) {
      ignoreSQLException(connection::close);
    }
  }
608184
static int deleteAll(CallInfo callInfo, Table table) {
    table.setDirtyStatus(true);
    return doDeleteAll(callInfo, table);
  }
393742
@Override
	public void close() {
		try {
			callbackRegistry.acceptConnectionStateChange(BitfinexConnectionStateEnum.DISCONNECTION_INIT);
			logger.debug("close() called");
			if (heartbeatThread != null) {
				heartbeatThread.interrupt();
				heartbeatThread = null;
			}

			if (websocketEndpoint != null) {
				websocketEndpoint.close();
				websocketEndpoint = null;
			}
			connectionStateChange(BitfinexConnectionStateEnum.DISCONNECTION_SUCCESS);
		} catch (final Exception e) {
			connectionStateChange(BitfinexConnectionStateEnum.DISCONNECTION_FAILED);
			throw new BitfinexClientException(e);
		}
	}
162530
public void close() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "close, vc=" + getVCHash());
        }

        synchronized (closeSync) {
            if (closeCalled) {
                return;
            }

            closeCalled = true;
            if (null != this.netBuffer) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Releasing netBuffer during close "
                                 + SSLUtils.getBufferTraceInfo(netBuffer));
                }
                this.netBuffer.release();
                this.netBuffer = null;
            }

            cleanupDecBuffers();
            if (unconsumedDecData != null) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Releasing unconsumed decrypted buffers, "
                                 + SSLUtils.getBufferTraceInfo(unconsumedDecData));
                }
                WsByteBufferUtils.releaseBufferArray(unconsumedDecData);
                unconsumedDecData = null;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "close");
        }
    }
8969
@Override
    public synchronized void close() {
        if (isOpen()) {
            clearCache();
            closeStatements();
            try {
                connection.close();
            } catch (SQLException ex) {
                LOGGER.error("There was an error attempting to close the CveDB, see the log for more details.");
                LOGGER.debug("", ex);
            } catch (Throwable ex) {
                LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details.");
                LOGGER.debug("", ex);
            }
            releaseResources();
            connectionFactory.cleanup();
        }
    }
1217778
@Override
  public void close() throws SQLException {
    if (queryExecutor == null) {
      // This might happen in case constructor throws an exception (e.g. host being not available).
      // When that happens the connection is still registered in the finalizer queue, so it gets finalized
      return;
    }
    releaseTimer();
    queryExecutor.close();
    openStackTrace = null;
  }
174827
private void cleanConnectionClose(Connection connection, Statement stmt) {
        try {
            // clean close
            if (connection != null) {
                connection.rollback();
            }

            if (stmt != null) {
                stmt.close();
            }

            if (connection != null) {
                connection.close();
            }
        } catch (SQLException e1) {
            e1.printStackTrace();
        }
    }
1061702
def closeConnection(self):
        """"""
        print '%s call closeConnection' % self.port
        try:
            if self.handle:
                self.handle.close()
                self.handle = None
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("closeConnection() Error: " + str(e))
1306343
protected void closeLocalConnection(Connection connection) {
    try {
      if (connection != null && !connection.isClosed()) {
        connection.close();
      }
    } catch (SQLException e) {
      if (logger.isTraceEnabled()) {
        logger.trace(e.getMessage());
      }
    }
  }
127971
private static int doDeleteAll(CallInfo callInfo, Table table) {
    DB db = table.getDB();
    return db.access(callInfo, () -> {
      String sql = DELETE_FROM_ + table.getName();
      db.logSetup(callInfo, sql);
      try (WrappedStatement ws = db.compile(sql)) {
        return ws.getStatement().executeUpdate();
      }
    });
  }
244821
@Override
	public void close(boolean compact, boolean cleanup) {
		logger.debug("close");
		super.close(compact, cleanup);
	    if (this.getDatabaseServer() == null) {
	    	return;
	    }
	    
	    try {
	        // shutdown
	    	((HsqldbDatabaseServer)this.getDatabaseServer()).shutdown(compact);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
	}
763033
@InterfaceAudience.Public
    public void close() {
        synchronized (lockDatabases) {
            Log.d(Database.TAG, "Closing " + this);

            // Close all database:
            // Snapshot of the current open database to avoid concurrent modification as
            // the database will be forgotten (removed from the databases map) when it is closed:
            Database[] openDbs = databases.values().toArray(new Database[databases.size()]);
            for (Database database : openDbs)
                database.close();
            databases.clear();

            // Stop reachability:
            context.getNetworkReachabilityManager().stopListening();

            // Shutdown ScheduledExecutorService:
            if (workExecutor != null && !workExecutor.isShutdown())
                Utils.shutdownAndAwaitTermination(workExecutor);

            Log.d(Database.TAG, "Closed " + this);
        }
    }
262065
protected void closeConnection(ConnectionHandle connection) {
		if (connection != null) {
			try {
				connection.internalClose();
			} catch (Throwable t) {
				logger.error("Destroy connection exception", t);
			} finally {
				this.pool.postDestroyConnection(connection);
			}
		}
}
1264834
private void releaseConnection()
   {
      if (m_rs != null)
      {
         try
         {
            m_rs.close();
         }

         catch (SQLException ex)
         {
            // silently ignore errors on close
         }

         m_rs = null;
      }

      if (m_ps != null)
      {
         try
         {
            m_ps.close();
         }

         catch (SQLException ex)
         {
            // silently ignore errors on close
         }

         m_ps = null;
      }
   }
1258260
public void processConnectionClosedEvent(WSJdbcConnection handle) 
    throws ResourceException {
        //A connection handle was closed - must notify the connection manager
        // of the close on the handle.  JDBC connection handles
        // which are closed are not allowed to be reused because there is no
        // guarantee that the user will not try to reuse an already closed JDBC handle.

        // Only send the event if the application is requesting the close. 
        if (cleaningUpHandles)
            return;

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        // Fill in the ConnectionEvent only if needed. 
        connEvent.recycle(ConnectionEvent.CONNECTION_CLOSED, null, handle);

        if (isTraceOn && tc.isEventEnabled())
            Tr.event(this, tc, "Firing CONNECTION CLOSED", handle);

        try {
            removeHandle(handle); 

            // - Remove resetting autocommit in connection close time
        } catch (NullPointerException nullX) {
            // No FFDC code needed.  ManagedConnection is already closed.

            // A ConnectionError situation may
            // trigger a ManagedConnection close before the handle sends the ConnectionClosed
            // event.  When the event is sent the ManagedConnection is already closed.  If so,
            // just do a no-op here.
            if (handlesInUse == null) {
                if (isTraceOn && tc.isEventEnabled())
                    Tr.event(this, tc, "ManagedConnection already closed"); 
                return;
            } else
                throw nullX;
        }

        if (numHandlesInUse == 0) 
        {
            if (haveVendorConnectionPropertiesChanged) {
                try {

                    helper.doConnectionVendorPropertyReset(this.sqlConn, CONNECTION_VENDOR_DEFAULT_PROPERTIES);
                } catch (SQLException sqle) {
                    FFDCFilter.processException(sqle, getClass().getName(), "1905", this);
                    throw new DataStoreAdapterException("DSA_ERROR", sqle, getClass());
                }

                haveVendorConnectionPropertiesChanged = false;
            }
        } 

        // loop through the listeners
        // Not synchronized because of contract that listeners will only be changed on
        // ManagedConnection create/destroy. 

        for (int i = 0; i < numListeners; i++) {
            // send Connection Closed event to the current listener
            ivEventListeners[i].connectionClosed(connEvent); 
        }

        // Replace ConnectionEvent caching with a single reusable instance per
        // ManagedConnection. 
    }
120221
private boolean closeConnection(Object c)
   {
      if (plugin == null)
         return false;

      log.debugf("Closing connection for recovery check (%s)", c);

      boolean forceClose = false;

      if (c != null)
      {
         try
         {
            forceClose = !plugin.isValid(c);
         }
         catch (ResourceException re)
         {
            log.debugf("Error during recovery plugin isValid()", re);
            forceClose = true;
         }

         try
         {
            plugin.close(c);
         }
         catch (ResourceException re)
         {
            log.debugf("Error during recovery plugin close()", re);
            forceClose = true;
         }
      }

      log.debugf("Force close=%s", forceClose);

      return forceClose;
   }
354901
void shutdown() throws IOException {
        synchronized (this) {
            for (BdbEnvironmentInfo envInfo : this.envInfos) {
                try {
                    envInfo.getClassCatalog().close();
                } catch (DatabaseException ignore) {
                    LOGGER.log(Level.SEVERE, "Failure closing class catalog", ignore);
                }
                envInfo.closeAndRemoveAllDatabaseHandles();
                
                try (Environment env = envInfo.getEnvironment()) {
                    if (this.deleteOnExit) {
                        FileUtil.deleteDirectory(env.getHome());
                    }
                }
            }
            this.envInfos.clear();
        }
    }