#vulnerable code 
                                public void run() {
        boolean readPackets = false;
        boolean readProcessables = false;
        while (running) {
            readPackets = (dequeuePackets() != 0);
            readProcessables = (dequeueProcessables() != 0);
            if (!readPackets && !readProcessables) {
                enqueueLock.lock();
                try {
                    notEmpty.await(100, TimeUnit.MILLISECONDS);
                    checkPeriodics();
                } catch (InterruptedException e) {
                    node.handleInterruptedException(Thread.currentThread(), e);
                } finally {
                    enqueueLock.unlock();
                }
            }
        }
        packetQueue.clear();
        processableQueue.clear();
    } 
                            #location 11 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public void run() {
        boolean readPackets = false;
        boolean readProcessables = false;
        while (running) {
            readPackets = (dequeuePackets() != 0);
            readProcessables = (dequeueProcessables() != 0);
            if (!readPackets && !readProcessables) {
                try {
                    synchronized (notEmptyLock) {
                        notEmptyLock.wait(100);
                    }
                    checkPeriodics();
                } catch (InterruptedException e) {
                    node.handleInterruptedException(Thread.currentThread(), e);
                }
            }
        }
        packetQueue.clear();
        processableQueue.clear();
    }