Update the status of the task.

This update is done by ping thread before sending the status.

@param progress
@param state
@param counters
556046
synchronized void statusUpdate(float progress,
                                 String state, 
                                 Counters counters) {
    setProgress(progress);
    setStateString(state);
    setCounters(counters);
  }
845103
def update_status(type, state)
      old_state, @status[type] = @status[type], state
      Log.info("Client #{type.inspect} changed state from #{old_state.inspect} to #{state.inspect}")
      @status_callbacks.each do |callback|
        begin
          callback.call(type, state)
        rescue RuntimeError => e
          ErrorTracker.log(self, "Failed status callback", e, nil, :caller)
        end
      end
      true
    end
40344
public void incrementFor(Status status) {
        final int statusCounter = getValueFor(status) + 1;
        this.counter.put(status, statusCounter);
        size++;

        if (finalStatus == Status.PASSED && status != Status.PASSED) {
            finalStatus = Status.FAILED;
        }
    }
50302
@Override
    public void setState(TransferState state) {
        super.setState(state);

        switch (state) {
        case Waiting:
            fireProgressEvent(ProgressEventType.TRANSFER_PREPARING_EVENT);
            break;
        case InProgress:
            if ( subTransferStarted.compareAndSet(false, true) ) {
                /* The first InProgress signal */
                fireProgressEvent(ProgressEventType.TRANSFER_STARTED_EVENT);
            }
            /* Don't need any event code update for subsequent InProgress signals */
            break;
        case Completed:
            fireProgressEvent(ProgressEventType.TRANSFER_COMPLETED_EVENT);
            break;
        case Canceled:
            fireProgressEvent(ProgressEventType.TRANSFER_CANCELED_EVENT);
            break;
        case Failed:
            fireProgressEvent(ProgressEventType.TRANSFER_FAILED_EVENT);
            break;
        default:
            break;
        }
    }
1226290
@Subscribe
    public void updateThrottleState(ThrottleState throttleState) {
        // Only run if throttling is enabled.
        if (!throttlingAllowed) {
            return;
        }
        // check if we are throttled
        final boolean throttled = determineIfThrottled(throttleState);
        if (currentlyThrottled.get()) {
            // no need to unblock
            if (throttled) {
                return;
            }
            // sanity check
            if (blockLatch == null) {
                log.error("Expected to see a transport throttle latch, but it is missing. This is a bug, continuing anyway.");
                return;
            }
            currentlyThrottled.set(false);
            handleChangedThrottledState(false);
            blockLatch.countDown();
        } else if (throttled) {
            currentlyThrottled.set(true);
            handleChangedThrottledState(true);
            blockLatch = new CountDownLatch(1);
        }
    }
956505
private void transitionToFinalBatchStatus() {
        StopLock stopLock = getStopLock(); // Store in local variable to facilitate Ctrl+Shift+G search in Eclipse
        synchronized (stopLock) {

            BatchStatus currentBatchStatus = runtimeWorkUnitExecution.getBatchStatus();
            if (currentBatchStatus.equals(BatchStatus.STARTED)) {
                updateJobBatchStatus(BatchStatus.COMPLETED);
            } else if (currentBatchStatus.equals(BatchStatus.STOPPING)) {
                updateJobBatchStatus(BatchStatus.STOPPED);
            } else if (currentBatchStatus.equals(BatchStatus.FAILED)) {
                updateJobBatchStatus(BatchStatus.FAILED); // Should have already been done but maybe better for possible code refactoring to have it here.
            } else {
                throw new IllegalStateException("Step batch status should not be in a " + currentBatchStatus.name() + " state");
            }
        }
    }
650282
void notifyStateTransition(Execution execution, ExecutionState newState, Throwable error) {
		// only forward this notification if the execution is still the current execution
		// otherwise we have an outdated execution
		if (currentExecution == execution) {
			getExecutionGraph().notifyExecutionChange(execution, newState, error);
		}
	}
272624
@Override
    public void setState(TransferState state) {
        super.setState(state);

        switch (state) {
            case Completed :
                fireProgressEvent(ProgressEventType.TRANSFER_COMPLETED_EVENT);
                break;
            case Canceled:
                fireProgressEvent(ProgressEventType.TRANSFER_CANCELED_EVENT);
                break;
            case Failed:
                fireProgressEvent(ProgressEventType.TRANSFER_FAILED_EVENT);
                break;
            default:
                break;
        }
    }
160596
public void fireProgressEvent(int state, int progress, String message) throws Exception {
        if (listenersMap != null) {
            Collection<InstallEventListener> listeners = listenersMap.get(InstallConstants.EVENT_TYPE_PROGRESS);
            if (listeners != null) {
                for (InstallEventListener listener : listeners) {
                    listener.handleInstallEvent(new InstallProgressEvent(state, progress, message));
                }
            }
        }
    }
1190000
@Override
	public CompletableFuture<Acknowledge> updateTaskExecutionState(
			final TaskExecutionState taskExecutionState) {
		checkNotNull(taskExecutionState, "taskExecutionState");

		if (executionGraph.updateState(taskExecutionState)) {
			return CompletableFuture.completedFuture(Acknowledge.get());
		} else {
			return FutureUtils.completedExceptionally(
				new ExecutionGraphException("The execution attempt " +
					taskExecutionState.getID() + " was not found."));
		}
	}
248743
public void queueStateChange(IState state)
    {
        synchronized(this.stateQueue)
        {
            if (this.stateQueue.size() != 0)
            {
                // The queue is only a method for ensuring the transition is carried out on the correct thread - transitions should
                // never happen so quickly that we end up with more than one state in the queue.
                System.out.println("STATE ERROR - multiple states in the queue.");
            }
            this.stateQueue.add(state);
            System.out.println(getName() + " request state: " + state);
            TCPUtils.Log(Level.INFO, "-------- " + getName() + " request state: " + state + " --------");
        }
    }
323227
@Override
    public void indicateProgress(int number, int total) {
        progressIndicatorActive = true;
        String currMsg = lastMessage;
        try {
            updateStatus(currMsg + ' ' + number + " of " + total);
        } finally {
            lastMessage = currMsg;
        }
    }
32230
public void updateProgress(float progress) {
        if (mLastProgress == progress) {
            return;
        }
        mLastProgress = progress;
        //TODO this makes ViewPager work, but will probably break more complex transition setup, will think of a better solution
        if (mUpdateStateAfterUpdateProgress) {
            boolean positive = progress >= 0;
            TransitionController transitionController;
            for (int i = 0, size = mTransitionControls.size(); i < size; i++) {
                transitionController = mTransitionControls.get(i);
                if (positive) {
                    if (transitionController.getEnd() > 0) {
                        transitionController.setEnable(true);
                    } else {
                        transitionController.setEnable(false);
                    }
                } else {
                    if (transitionController.getEnd() < 0) {
                        transitionController.setEnable(true);
                    } else {
                        transitionController.setEnable(false);
                    }
                }
            }
        }

        TransitionController transitionController;
        for (int i = 0, size = mTransitionControls.size(); i < size; i++) {
            transitionController = mTransitionControls.get(i);
            if (transitionController.isEnable()) {
                transitionController.updateProgress(progress);
            }
        }
    }
1370089
public void updateProgress(long latestProgress, long expectedProgress) {
        lastProgress = progress;
        progress = latestProgress;
        expected = expectedProgress;

        if (connected() == false)
            state = State.CONNECTED;
        else
            state = State.UPDATE;

        // The threshold effectively divides the progress into
        // different set of ranges:
        //
        //      Range 0: 0..threshold-1,
        //      Range 1: threshold .. 2*threshold-1
        //      ....
        //      Range n: n*threshold .. (n+1)*threshold-1
        //
        // To determine which range the progress belongs to, it
        // would be calculated as follow:
        //
        //      range number = progress / threshold
        //
        // Notification should only be triggered when the current
        // progress and the last progress are in different ranges,
        // i.e. they have different range numbers.
        //
        // Using this range scheme, notification will be generated
        // only once when the progress reaches each range.
        //
        if (lastProgress / threshold != progress / threshold)   {
            progressMonitor.updateProgress(this);
        }

        // Detect read overrun
        if (expected != -1) {
            if (progress >= expected && progress != 0)
                close();
        }
    }
1261964
public void updateProgress(int progress, int maxProgress) {
		int increment = (int)((double)(stopValue - startValue) * ((double)maxProgress / (double)progress));
		progressBar.setValue(startValue + increment);
	}
392696
private void setState(IState toState)
    {
        // We want to make sure state changes happen purely on the "home" thread,
        // for the sake of sanity and avoiding many obscure race-condition bugs.
        if (Thread.currentThread() == this.homeThread)
        {
            // We are on the home thread, so safe to proceed:
            if (this.state != toState)
            {
                System.out.println(getName() + " enter state: " + toState);
                TCPUtils.Log(Level.INFO, "======== " + getName() + " enter state: " + toState + " ========");
                this.state = toState;
                onPreStateChange(toState);
                onStateChange();
            }
        }
        else
        {
            // We are not on the home thread; queue this state transition
            // so that the home thread can act on it.
            queueStateChange(toState);
        }
    }
318604
@Override
    public void indicateProgress() {
        verifySystemOut();
        progressIndicatorActive = true;
        if (isAnsiEnabled()) {
            if (lastMessage != null && lastMessage.length() > 0) {
                if (!lastMessage.contains(maxIndicatorString)) {
                    updateStatus(lastMessage + indicator);
                }
            }
        } else {
            out.print(indicator);
        }
    }