#vulnerable code 
                              public void run() throws IOException {
    hostConfig.setState(HostState.IDLE);

    if (hostConfig.getCurrentCommand() != null) {
      processCurrentCommand(hostConfig, hostConfig.getCurrentCommand());
    }
    while (!goingDown) {
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        LOG.debug("Interrupted in run loop. Exiting.");
        break;
      }
    }
    hostConfig.setState(HostState.OFFLINE);
  } 
                            #location 5 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                              public void run() throws IOException {
    hostConfig.setState(HostState.IDLE);

    processCommands();
    while (!goingDown) {
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        LOG.debug("Interrupted in run loop. Exiting.");
        break;
      }
    }
    hostConfig.setState(HostState.OFFLINE);
  }