#fixed code
                                @Override
    public void stop() {
        try {
            this.lock.writeLock().lock();
            this.stop = true;
            this.torrentFileProvider.unRegisterListener(this);
            this.thread.interrupt();
            try {
                this.thread.join();
            } catch (final InterruptedException ignored) {
            }
            this.delayQueue.drainAll().stream()
                    .filter(req -> req.getEvent() != RequestEvent.STARTED)
                    .map(AnnounceRequest::getAnnouncer)
                    .map(AnnounceRequest::createStop)
                    .forEach(this.announcerExecutor::execute);

            this.announcerExecutor.awaitForRunningTasks();
        } finally {
            this.lock.writeLock().unlock();
        }
    }
#vulnerable code 
                                @Override
    public void stop() {
        this.stop = true;
        this.torrentFileProvider.unRegisterListener(this);
        this.thread.interrupt();
        try {
            this.thread.join();
        } catch (final InterruptedException ignored) {
        }
        this.delayQueue.drainAll().stream()
                .filter(req -> req.getEvent() != RequestEvent.STARTED)
                .map(AnnounceRequest::getAnnouncer)
                .map(AnnounceRequest::createStop)
                .forEach(this.announcerExecutor::execute);

        this.announcerExecutor.awaitForRunningTasks();
    } 
                            #location 7 
                            #vulnerability type THREAD_SAFETY_VIOLATION