code: public static void endTransaction() {
          ifNotNullThen(localConnection.get(),
                  () -> {
                      Connection connection = localConnection.get();
                      ifThen(connection.isRollbackOnClose(), connection::close);
                      localConnection.remove();
                  });
      }
docs: End a transaction.