#vulnerable code 
                                public void setup() {
        // Might have to manually load a checkpoint.
        // In that case, the input splits are not set, they will be faked by
        // the checkpoint files.  Each checkpoint file will be an input split
        // and the input split
        superstepCounter = getContext().getCounter(
            "Giraph Stats", "Superstep");
        vertexCounter = getContext().getCounter(
            "Giraph Stats", "Aggregate vertices");
        finishedVertexCounter = getContext().getCounter(
            "Giraph Stats", "Aggregate finished vertices");
        edgeCounter = getContext().getCounter(
            "Giraph Stats", "Aggregate edges");
        sentMessagesCounter = getContext().getCounter(
            "Giraph Stats", "Sent messages");
        currentWorkersCounter = getContext().getCounter(
            "Giraph Stats", "Current workers");
        if (getRestartedSuperstep() == -1) {
            return;
        }
        else if (getRestartedSuperstep() < -1) {
            LOG.fatal("setup: Impossible to restart superstep " +
                      getRestartedSuperstep());
            setJobState(BspService.State.FAILED, -1, -1);
        } else {
            superstepCounter.increment(getRestartedSuperstep());
        }

    } 
                            #location 24 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public void setup() {
        // Might have to manually load a checkpoint.
        // In that case, the input splits are not set, they will be faked by
        // the checkpoint files.  Each checkpoint file will be an input split
        // and the input split
        superstepCounter = getContext().getCounter(
            "Giraph Stats", "Superstep");
        vertexCounter = getContext().getCounter(
            "Giraph Stats", "Aggregate vertices");
        finishedVertexCounter = getContext().getCounter(
            "Giraph Stats", "Aggregate finished vertices");
        edgeCounter = getContext().getCounter(
            "Giraph Stats", "Aggregate edges");
        sentMessagesCounter = getContext().getCounter(
            "Giraph Stats", "Sent messages");
        currentWorkersCounter = getContext().getCounter(
            "Giraph Stats", "Current workers");
        if (getRestartedSuperstep() != UNSET_SUPERSTEP) {
            superstepCounter.increment(getRestartedSuperstep());
        }
    }