#fixed code
                                public void cleanup() throws DBException
    {
        // Get the measurements instance as this is the only client that should
        // count clean up time like an update since autoflush is off.
        Measurements _measurements = Measurements.getMeasurements();
        try {
            long st=System.nanoTime();
            if (_hTable != null) {
                _hTable.flushCommits();
            }
            synchronized(THREAD_COUNT) {
              int threadCount = THREAD_COUNT.decrementAndGet();
              if (threadCount <= 0 && _hConn != null) {
                 _hConn.close();
              }
            }
            long en=System.nanoTime();
            _measurements.measure("UPDATE", (int)((en-st)/1000));
        } catch (IOException e) {
            throw new DBException(e);
        }
    }
#vulnerable code 
                                public void cleanup() throws DBException
    {
        // Get the measurements instance as this is the only client that should
        // count clean up time like an update since autoflush is off.
        Measurements _measurements = Measurements.getMeasurements();
        try {
            long st=System.nanoTime();
            if (_hTable != null) {
                _hTable.flushCommits();
            }
            if (_hConn != null) {
                _hConn.close();
            }
            long en=System.nanoTime();
            _measurements.measure("UPDATE", (int)((en-st)/1000));
        } catch (IOException e) {
            throw new DBException(e);
        }
    } 
                            #location 9 
                            #vulnerability type THREAD_SAFETY_VIOLATION