public void close(ThreadLocal<DelegatingDbSessionSupplier> dbSessionThreadLocal, String label) {
    DelegatingDbSessionSupplier delegatingDbSessionSupplier = dbSessionThreadLocal.get();
    boolean getCalled = delegatingDbSessionSupplier.isPopulated();
    if (getCalled) {
      try {
        DbSession res = delegatingDbSessionSupplier.get();
        res.close();
      } catch (Exception e) {
        LOG.error(format("Failed to close %s connection in %s", label, currentThread()), e);
      }
    }
  }
@Test
  void openSession_with_caching_returns_DbSession_that_does_not_roll_back_on_close_if_any_mutation_call_was_followed_by_rollback_with_parameters() throws SQLException {
    boolean force = random.nextBoolean();
    DbSession dbSession = openSessionAndDoSeveralMutatingAndNeutralCalls();
    dbSession.rollback(force);

    dbSession.close();

    verify(myBatisDbSession, times(1)).rollback(force);
    verify(myBatisDbSession, times(0)).rollback();
  }