#fixed code
                                public void installSnapshot(Peer peer) {
        Raft.InstallSnapshotRequest.Builder requestBuilder = Raft.InstallSnapshotRequest.newBuilder();
        requestBuilder.setServerId(localServer.getServerId());
        requestBuilder.setTerm(currentTerm);
        // send snapshot
        Raft.InstallSnapshotRequest request = this.buildInstallSnapshotRequest(
                null, 0, 0);
        peer.getRpcClient().asyncCall("RaftConsensusService.installSnapshot",
                request, new InstallSnapshotResponseCallback(peer, request));
        isSnapshoting = true;

    }
#vulnerable code 
                                public void installSnapshot(Peer peer) {
        Raft.InstallSnapshotRequest.Builder requestBuilder = Raft.InstallSnapshotRequest.newBuilder();
        requestBuilder.setServerId(localServer.getServerId());
        requestBuilder.setTerm(currentTerm);
        // send snapshot
        try {
            snapshotLock.readLock().lock();
            Raft.InstallSnapshotRequest request = this.buildInstallSnapshotRequest(
                    null, 0, 0);
            peer.getRpcClient().asyncCall("RaftConsensusService.installSnapshot",
                    request, new InstallSnapshotResponseCallback(peer, request));
            isSnapshoting = true;
        } finally {
            snapshotLock.readLock().unlock();
        }

    } 
                            #location 4 
                            #vulnerability type THREAD_SAFETY_VIOLATION