#fixed code
                              @Override
  public void cleanup() throws DBException {
    if (asyncExecutor != null) {
      try {
        asyncExecutor.flush();
      } catch (IOException e) {
        throw new DBException(e);
      }
    }
    synchronized (CONFIG) {
      --threadCount;
      if (threadCount <= 0) {
        try {
          session.close();
        } catch (IOException e) {
          throw new DBException(e);
        }
      }
    }
  }
#vulnerable code 
                              @Override
  public void cleanup() throws DBException {
    if (asyncExecutor != null) {
      try {
        asyncExecutor.flush();
      } catch (IOException e) {
        throw new DBException(e);
      }
    }
    synchronized (threadCount) {
      --threadCount;
      if (threadCount <= 0) {
        try {
          session.close();
        } catch (IOException e) {
          throw new DBException(e);
        }
      }
    }
  } 
                            #location 10 
                            #vulnerability type THREAD_SAFETY_VIOLATION