#vulnerable code 
                                boolean stopCompactionThread() throws IOException {
        isRunning = false;
        if (compactionThread != null) {
            try {
                // We don't want to call interrupt on compaction thread as it
                // may interrupt IO operations and leave files in an inconsistent state.
                // instead we use -10101 as a stop signal.
                compactionQueue.put(STOP_SIGNAL);
                compactionThread.join();
                if (currentWriteFile != null) {
                    currentWriteFile.flushToDisk();
                    currentWriteFile.getIndexFile().flushToDisk();
                    currentWriteFile.close();
                }
            } catch (InterruptedException e) {
                logger.error("Error while waiting for compaction thread to stop", e);
                return false;
            }
        }
        return true;
    } 
                            #location 9 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                CompactionManager(HaloDBInternal dbInternal) {
        this.dbInternal = dbInternal;
        this.compactionRateLimiter = RateLimiter.create(dbInternal.options.getCompactionJobRate());
        this.compactionQueue = new LinkedBlockingQueue<>();
    }