Notify all subscribing monitors of a updated event.

@param resource the url of the updated resource
@param expected the size in bytes of the download
@param count    the progress in bytes
772848
public void notifyUpdate( URL resource, int expected, int count )
    {
        synchronized( m_Monitors )
        {
            for( StreamMonitor monitor : m_Monitors )
            {
                monitor.notifyUpdate( resource, expected, count );
            }
        }
    }
1081594
private void waitUntilDeploymentIsScaled(final int count) {
    final BlockingQueue<Object> queue = new ArrayBlockingQueue<>(1);
    final AtomicReference<Integer> replicasRef = new AtomicReference<>(0);

    final String name = checkName(getItem());
    final String namespace = checkNamespace(getItem());

    final Runnable deploymentPoller = () -> {
      try {
        Deployment deployment = get();
        //If the deployment is gone, we shouldn't wait.
        if (deployment == null) {
          if (count == 0) {
            queue.put(true);
            return;
          } else {
            queue.put(new IllegalStateException("Can't wait for Deployment: " + checkName(getItem()) + " in namespace: " + checkName(getItem()) + " to scale. Resource is no longer available."));
            return;
          }
        }

        replicasRef.set(deployment.getStatus().getReplicas());
        int currentReplicas = deployment.getStatus().getReplicas() != null ? deployment.getStatus().getReplicas() : 0;
        long generation = deployment.getMetadata().getGeneration() != null ? deployment.getMetadata().getGeneration() : 0;
        long observedGeneration = deployment.getStatus() != null && deployment.getStatus().getObservedGeneration() != null ? deployment.getStatus().getObservedGeneration() : -1;
        if (observedGeneration >= generation && Objects.equals(deployment.getSpec().getReplicas(), currentReplicas)) {
          queue.put(true);
        } else {
          LOG.debug("Only {}/{} pods scheduled for Deployment: {} in namespace: {} seconds so waiting...",
            deployment.getStatus().getReplicas(), deployment.getSpec().getReplicas(), deployment.getMetadata().getName(), namespace);
        }
      } catch (Throwable t) {
        LOG.error("Error while waiting for Deployment to be scaled.", t);
      }
    };

    ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    ScheduledFuture poller = executor.scheduleWithFixedDelay(deploymentPoller, 0, POLL_INTERVAL_MS, TimeUnit.MILLISECONDS);
    try {
      if (Utils.waitUntilReady(queue, getConfig().getScaleTimeout(), TimeUnit.MILLISECONDS)) {
        LOG.debug("{}/{} pod(s) ready for Deployment: {} in namespace: {}.",
          replicasRef.get(), count, name, namespace);
      } else {
        LOG.error("{}/{} pod(s) ready for Deployment: {} in namespace: {}  after waiting for {} seconds so giving up",
          replicasRef.get(), count, name, namespace, TimeUnit.MILLISECONDS.toSeconds(getConfig().getScaleTimeout()));
      }
    } finally {
      poller.cancel(true);
      executor.shutdown();
    }
  }
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);
        }
    }
1372798
public void notifyStatusChanged(String status) {

    /* If the new status message is shorter than the previous one, then
     * first change the status message all spaces to clear out the previous
     * message.
     */
    if (status.length() < this.status.length()) {
      this.status = this.status.replaceAll(".", " ");
      this.printProgressBar();
    }

    this.status = status;
    this.printProgressBar();

  }
578042
public static void notifyChange(ContentProvider provider, Uri uri, ContentObserver observer) {
        notifyChange(provider.getContext(), uri, observer);
    }
769748
@Override
    protected void updateCount() {
        // set counter to the actual value, rather than to try and
        // keep track with a seperate variable.
        // This counter must only be updated by the selector thread,
        // which allows us to omit synchronized logic.
        // there can be timing windows where before we signal a deletion,
        // another request comes in, but the timeout logic will insure
        // that we don't delete an active selector.
        final int selectorCount = selector.keys().size();
        if (selectorCount > 0) {
            // if any keys, don't let selector die
            waitingToQuit = false;
        }
        wqm.updateCount(countIndex, selectorCount, channelType);
    }
1065367
public void notifyMonitors(ProcessInstance processInstance, String event) {
        // notify registered monitors
        Process processVO = getMainProcessDefinition(processInstance);
        Package pkg = PackageCache.getProcessPackage(processVO.getId());
        // runtime context for enablement does not contain hydrated variables map (too expensive)
        List<ProcessMonitor> monitors = MonitorRegistry.getInstance()
                .getProcessMonitors(new ProcessRuntimeContext(pkg, processVO, processInstance,
                        getDataAccess().getPerformanceLevel(), isInService(), new HashMap<>()));
        if (!monitors.isEmpty()) {
            Map<String,Object> vars = new HashMap<>();
            if (processInstance.getVariables() != null) {
                for (VariableInstance var : processInstance.getVariables()) {
                    Object value = var.getData();
                    if (value instanceof DocumentReference) {
                        try {
                            Document docVO = getDocument((DocumentReference) value, false);
                            value = docVO == null ? null : docVO.getObject(var.getType(), pkg);
                        }
                        catch (DataAccessException ex) {
                            logger.severeException(ex.getMessage(), ex);
                        }
                    }
                    vars.put(var.getName(), value);
                }
            }
            ProcessRuntimeContext runtimeContext = new ProcessRuntimeContext(pkg, processVO, processInstance,
                    getDataAccess().getPerformanceLevel(), isInService(), vars);

            for (ProcessMonitor monitor : monitors) {
                try {
                    if (monitor instanceof OfflineMonitor) {
                        @SuppressWarnings("unchecked")
                        OfflineMonitor<ProcessRuntimeContext> processOfflineMonitor = (OfflineMonitor<ProcessRuntimeContext>) monitor;
                        new OfflineMonitorTrigger<>(processOfflineMonitor, runtimeContext).fire(event);
                    }
                    else {
                        if (WorkStatus.LOGMSG_PROC_START.equals(event)) {
                            Map<String,Object> updated = monitor.onStart(runtimeContext);
                            if (updated != null) {
                                for (String varName : updated.keySet()) {
                                    if (processInstance.getVariables() == null)
                                        processInstance.setVariables(new ArrayList<>());
                                    Variable varVO = processVO.getVariable(varName);
                                    if (varVO == null || !varVO.isInput())
                                        throw new ProcessException("Process '" + processVO.getFullLabel() + "' has no such input variable defined: " + varName);
                                    if (processInstance.getVariable(varName) != null)
                                        throw new ProcessException("Process '" + processVO.getFullLabel() + "' input variable already populated: " + varName);
                                    if (VariableTranslator.isDocumentReferenceVariable(runtimeContext.getPackage(), varVO.getType())) {
                                        DocumentReference docRef = createDocument(varVO.getType(), OwnerType.VARIABLE_INSTANCE, new Long(0),
                                                updated.get(varName));
                                        VariableInstance varInst = createVariableInstance(processInstance, varName, docRef);
                                        updateDocumentInfo(docRef, processVO.getVariable(varInst.getName()).getType(), OwnerType.VARIABLE_INSTANCE,
                                                varInst.getInstanceId(), null, null);
                                        processInstance.getVariables().add(varInst);
                                    }
                                    else {
                                        VariableInstance varInst = createVariableInstance(processInstance, varName, updated.get(varName));
                                        processInstance.getVariables().add(varInst);
                                    }
                                }
                            }
                        }
                        else if (WorkStatus.LOGMSG_PROC_ERROR.equals(event)) {
                            monitor.onError(runtimeContext);
                        }
                        else if (WorkStatus.LOGMSG_PROC_COMPLETE.equals(event)) {
                            monitor.onFinish(runtimeContext);
                        }
                    }
                }
                catch (Exception ex) {
                    logger.severeException(ex.getMessage(), ex);
                }
            }
        }
    }
677260
public void awaitCount(long totalCount) throws InterruptedException
  {
    checkTotalCount(totalCount);
    long currentCount = sync.getCount();
    while (compareCounts(totalCount, currentCount) > 0) {
      sync.acquireSharedInterruptibly(currentCount);
      currentCount = sync.getCount();
    }
  }
217567
protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) {
		// Add Abort action to the notification
		if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) {
			final Intent abortIntent = new Intent(BROADCAST_ACTION);
			abortIntent.putExtra(EXTRA_ACTION, ACTION_ABORT);
			final PendingIntent pendingAbortIntent = PendingIntent.getBroadcast(this, 1, abortIntent, PendingIntent.FLAG_UPDATE_CURRENT);
			builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_abort), pendingAbortIntent);
		}
	}
689376
@Override
    public void indicateProgress(int number) {
        verifySystemOut();
        progressIndicatorActive = true;
        String currMsg = lastMessage;
        try {
            if (isAnsiEnabled()) {
                updateStatus(currMsg + ' ' + number);
            } else {
                out.print("..");
                out.print(number);
            }
        } finally {
            lastMessage = currMsg;
        }
    }
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));
                }
            }
        }
    }
836516
@MainThread
    private void handleEventPost(Event event) {
        Utils.log(event.getKey(), "Handling posted event");

        int sizeBefore = executionQueue.size();

        scheduleStatusUpdates(event, EventStatus.STARTED);
        scheduleSubscribersInvocation(event);

        if (((EventBase) event).handlersCount == 0) {
            Utils.log(event.getKey(), "No subscribers found");
            // Removing all scheduled STARTED status callbacks
            while (executionQueue.size() > sizeBefore) {
                executionQueue.removeLast();
            }
        } else {
            activeEvents.add(event);
            executeTasks(false);
        }
    }
505587
private void updateCount() {
		if (scanStatus == null) {
			return;
		}

		long now = System.currentTimeMillis();
		if (now - this.lastUpdated > 200) {
			// Dont update too frequently, eg using the spider could hammer the UI unnecessarily
			this.lastUpdated = now;
			SwingUtilities.invokeLater(new Runnable(){
				@Override
				public void run() {
					scanStatus.setScanCount(nodeStack.size());
				}});
		}
	}
1119869
public void setCount(int count)
    {
        if (count < 0 || 0xFF < count)
        {
            throw new IllegalArgumentException("'count' is out of the valid range: " + count);
        }

        mCount = count;

        getData()[COUNT_INDEX] = (byte)count;
    }
1214051
@Override
  public void eventReceived(EventSubscriptionEntity eventSubscriptionEntity, Object payload, boolean processASync) {
    if (processASync) {
      scheduleEventAsync(eventSubscriptionEntity, payload);
    } else {
      processEventSync(eventSubscriptionEntity, payload);
    }
  }
350494
async def _on_progress_notification(self, progress):
        

        conn_string = progress.get('connection_string')
        done = progress.get('done_count')
        total = progress.get('total_count')
        operation = progress.get('operation')

        await self.notify_progress(conn_string, operation, done, total, wait=True)
36782
@Override
    public void afterCompletion(int status) {
        if (status == Status.STATUS_COMMITTED) {
            Boolean previous = persistentExecutor.inMemoryTaskIds.put(taskId, Boolean.TRUE);
            if (previous == null) {
                long delay = expectedExecTime - new Date().getTime();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(this, tc, "Schedule " + taskId + " for " + delay + "ms from now");
                persistentExecutor.scheduledExecutor.schedule(this, delay, TimeUnit.MILLISECONDS);
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(this, tc, "Found task " + taskId + " already scheduled");
            }
        }
    }