public void close() throws SQLException {
        // Close underlying connection.
        if (connection != null) {
            try {
                connection.close();
            } finally {
                connectionsOnThread.get().remove(connection);
                if (connectionsOnThread.get().isEmpty()) {
                    connectionsOnThread.remove();
                }
            }
        }
    }
Creates a new ProfiledConnection that wraps the specified connection.

@param connection the Connection to wrap and collect stats for.
xmppserver/src/main/java/org/jivesoftware/database/ProfiledConnection.java