#vulnerable code 
                                public void handleClose() throws IOException {
        log.debug("Received SSH_MSG_CHANNEL_CLOSE on channel {}", id);
        synchronized (lock) {
            closedByOtherSide = !closing;
            if (closedByOtherSide) {
                close(false);
            } else {
                close(false).setClosed();
                doClose();
                lock.notifyAll();
            }
        }
    } 
                            #location 2 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public void handleClose() throws IOException {
        log.debug("Received SSH_MSG_CHANNEL_CLOSE on channel {}", id);
        closedByOtherSide = !closing.get();
        if (closedByOtherSide) {
            close(false);
        } else {
            close(false).setClosed();
            notifyStateChanged();
        }
    }