Fire complete for HintsContext
@param work The work instance
169561
private void fireHintsComplete(Work work)
   {
      if (work != null && work instanceof WorkContextProvider)
      {
         WorkContextProvider wcProvider = (WorkContextProvider) work;
         List<WorkContext> contexts = wcProvider.getWorkContexts();

         if (contexts != null && !contexts.isEmpty())
         {
            Iterator<WorkContext> it = contexts.iterator();
            while (it.hasNext())
            {
               WorkContext wc = it.next();
               if (wc instanceof HintsContext)
               {
                  HintsContext hc = (HintsContext) wc;
                  if (hc instanceof WorkContextLifecycleListener)
                  {
                     WorkContextLifecycleListener listener = (WorkContextLifecycleListener)hc;
                     listener.contextSetupComplete();   
                  }
               }
            }
         }
      }
   }
469028
void fireOnOpen(ConnectionEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ConnectionListener amqpListener = (ConnectionListener)listener;
            amqpListener.onConnectionOpen(e);
        }
    }
948736
protected final void fireUpdateWork(String message, long finished) {
	Iterator<WeakReference<ProgressObserver<Observable>>> iterator = observers
		.iterator();
	while (iterator.hasNext()) {
	    WeakReference<ProgressObserver<Observable>> weakReference = iterator
		    .next();
	    ProgressObserver<Observable> observer = weakReference.get();
	    if (observer == null) {
		observers.remove(weakReference);
	    } else {
		observer.updateWork(observable, message, finished);
	    }
	}
    }
1017241
private void checkAndVerifyWork(Work work, ExecutionContext executionContext) throws WorkException
   {
      if (specCompliant)
      {
         verifyWork(work);
      }

      if (work instanceof WorkContextProvider && executionContext != null)
      {
         //Implements WorkContextProvider and not-null ExecutionContext
         throw new WorkRejectedException(bundle.workExecutionContextMustNullImplementsWorkContextProvider());
      }
   }
1022777
protected void fireContextCreated(AgentContext context) {
		final ContextRepositoryListener[] ilisteners = this.listeners.getListeners(ContextRepositoryListener.class);
		this.logger.getKernelLogger().info(MessageFormat.format(Messages.StandardContextSpaceService_0, context.getID()));
		for (final ContextRepositoryListener listener : ilisteners) {
			listener.contextCreated(context);
		}
	}
730780
private void verifyWork(Work work) throws WorkException
   {
      Class<? extends Work> workClass = work.getClass();
      String className = workClass.getName();

      if (!validatedWork.contains(className))
      {

         if (isWorkMethodSynchronized(workClass, RUN_METHOD_NAME))
            throw new WorkException(bundle.runMethodIsSynchronized(className));

         if (isWorkMethodSynchronized(workClass, RELEASE_METHOD_NAME))
            throw new WorkException(bundle.releaseMethodIsSynchronized(className));

         validatedWork.add(className);
      }
   }
1321632
@Trivial
    private void beforeRunCheck(
                                Work work,
                                WorkListener workListener,
                                long startTimeout) throws WorkRejectedException {

        WorkRejectedException wrex = null;
        if (work == null) {
            wrex = new WorkRejectedException(new NullPointerException("work"));
            wrex.setErrorCode(WorkException.UNDEFINED);
        } else if (startTimeout < WorkManager.IMMEDIATE)
            wrex = new WorkRejectedException("startTimeout=" + startTimeout, WorkException.START_TIMED_OUT);
        else if (stopped)
            wrex = new WorkRejectedException(new UnavailableException(bootstrapContext.resourceAdapterID));

        if (wrex != null) {
            if (workListener != null) {
                WorkEvent event = new WorkEvent(work == null ? this : work, WorkEvent.WORK_REJECTED, work, wrex);
                workListener.workRejected(event);
            }
            throw wrex;
        }
    }
1063728
@Override
    public void onCompleted(WorkflowRun workflowRun, @Nonnull TaskListener listener) {
        super.onCompleted(workflowRun, listener);

        // Note: run.duration is zero in onCompleted(), do the substraction in this listener
        Result result = workflowRun.getResult();
        if (result == null) {
            result = Result.SUCCESS; // FIXME more elegant handling
        }
        globalPipelineMavenConfig.getDao().updateBuildOnCompletion(
                workflowRun.getParent().getFullName(),
                workflowRun.getNumber(),
                result.ordinal,
                workflowRun.getStartTimeInMillis(),
                 Math.max(System.currentTimeMillis() - workflowRun.getStartTimeInMillis(), 0)); // @see HUDSON-5844
    }
1179814
public static void fire(final HasHideHandlers source) {
        if (TYPE != null) {
            HideEvent event = new HideEvent();
            source.fireEvent(event);
        }
    }
451618
public void doFirstChecks(Work work, long startTimeout, ExecutionContext execContext) throws WorkException
   {
      if (isShutdown())
         throw new WorkRejectedException(bundle.workmanagerShutdown());

      if (work == null)
         throw new WorkRejectedException(bundle.workIsNull());

      if (startTimeout < 0)
         throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout));

      checkAndVerifyWork(work, execContext);
   }
123301
protected void fireFinish(CmsPublishJobRunning publishJob) {

        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_PUBLISH_JOB_FINISH_0));
        }
        for (Iterator<I_CmsPublishEventListener> it = iterator(); it.hasNext();) {
            I_CmsPublishEventListener listener = it.next();
            try {
                listener.onFinish(publishJob);
            } catch (Throwable t) {
                // catch every thing including runtime exceptions
                if (LOG.isErrorEnabled()) {
                    LOG.error(
                        Messages.get().getBundle().key(
                            Messages.ERR_PUBLISH_JOB_FINISH_ERROR_1,
                            listener.getClass().getName()),
                        t);
                }
                if (publishJob.m_publishJob.getPublishReport() != null) {
                    publishJob.m_publishJob.getPublishReport().println(t);
                }
            }
        }
        // popup the finish message
        String msgText;
        boolean hasError = false;
        if (!publishJob.getReport().hasError() && !publishJob.getReport().hasWarning()) {
            msgText = Messages.get().getBundle(publishJob.getLocale()).key(
                Messages.GUI_PUBLISH_JOB_FINISHED_1,
                new Long(publishJob.getEnqueueTime()));
        } else {
            hasError = true;
            Object[] params = new Object[] {
                new Long(publishJob.getEnqueueTime()),
                new Integer(publishJob.getReport().getErrors().size()),
                new Integer(publishJob.getReport().getWarnings().size())};
            msgText = Messages.get().getBundle(publishJob.getLocale()).key(
                Messages.GUI_PUBLISH_JOB_FINISHED_WITH_WARNS_3,
                params);
        }
        m_publishEngine.sendMessage(publishJob.getUserId(), msgText, hasError);
    }
1172561
private ThreadContextDescriptor appendInflowContext() throws WorkCompletedException {
        ThreadContextDescriptor merged = threadContextDescriptor.clone();
        Set<String> inflowContext = new HashSet<String>();

        // WorkContext
        if (workContexts != null)
            for (WorkContext workContext : workContexts)
                if (workContext instanceof HintsContext) {
                    if (hintsContextSetupFailure != null)
                        throw contextSetupFailure(workContext, WorkContextErrorCodes.CONTEXT_SETUP_FAILED, hintsContextSetupFailure);
                } else {
                    JCAContextProvider provider = bootstrapContext.getJCAContextProvider(workContext.getClass());
                    if (provider == null)
                        throw contextSetupFailure(workContext, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE, null);
                    else {
                        ThreadContext context;
                        try {
                            context = provider.getInflowContext(workContext, executionProperties);
                        } catch (Throwable x) {
                            throw contextSetupFailure(workContext, WorkContextErrorCodes.CONTEXT_SETUP_FAILED, x);
                        }
                        String workContextProviderName = bootstrapContext.getJCAContextProviderName(workContext.getClass());
                        if (!inflowContext.add(workContextProviderName))
                            throw contextSetupFailure(workContext, WorkContextErrorCodes.DUPLICATE_CONTEXTS, null);
                        merged.set(workContextProviderName, context);
                    }
                }

        // ExecutionContext
        if (executionContext != null)
            if (inflowContext.isEmpty() && (executionContext.getXid() != null || executionContext.getTransactionTimeout() != WorkManager.UNKNOWN)) {
                JCAContextProvider provider = bootstrapContext.getJCAContextProvider(TransactionContext.class);
                if (provider == null)
                    throw contextSetupFailure(executionContext, WorkContextErrorCodes.UNSUPPORTED_CONTEXT_TYPE, null);
                ThreadContext context;
                try {
                    context = provider.getInflowContext(executionContext, executionProperties);
                } catch (Throwable x) {
                    throw contextSetupFailure(executionContext, WorkContextErrorCodes.CONTEXT_SETUP_FAILED, x);
                }
                String executionContextHandlerName = bootstrapContext.getJCAContextProviderName(TransactionContext.class);
                merged.set(executionContextHandlerName, context);
            } // else - already checked for this error condition earlier

        return merged;
    }
379380
def onComplete(self, *args, **kwargs):
        
        with transactUI(self):
            if self.clientRunner.was_success():
                if self.buildSpec.get('return_to_config', False):
                    self.showSettings()
                else:
                    self.showSuccess()
                    if self.buildSpec.get('show_success_modal', True):
                        wx.CallAfter(modals.showSuccess)
            else:
                if self.clientRunner.wasForcefullyStopped:
                    self.showForceStopped()
                else:
                    self.showError()
                    wx.CallAfter(modals.showFailure)
564603
private void prepareExecutionAttempt(AsyncExecutionContextImpl<W> executionContext) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Execution {0} enqueuing new execution attempt", executionContext.getId());
        }

        AsyncAttemptContextImpl<W> attemptContext = new AsyncAttemptContextImpl<>(executionContext);

        TimeoutState timeout = FaultToleranceStateFactory.INSTANCE.createTimeoutState(executorService, timeoutPolicy, metricRecorder);
        attemptContext.setTimeoutState(timeout);

        if (!circuitBreaker.requestPermissionToExecute()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Execution {0} Circuit Breaker open, not executing", executionContext.getId());
            }

            MethodResult<W> result = MethodResult.failure(new CircuitBreakerOpenException());
            processEndOfAttempt(attemptContext, result);
            return;
        }

        attemptContext.setCircuitBreakerPermittedExecution(true);

        timeout.start();

        ExecutionReference ref = bulkhead.submit((reservation) -> runExecutionAttempt(attemptContext, reservation), getExceptionHandler(attemptContext));

        if (!ref.wasAccepted()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Execution {0} bulkhead rejected execution", executionContext.getId());
            }

            processEndOfAttempt(attemptContext, MethodResult.failure(new BulkheadException()));
            return;
        }

        timeout.setTimeoutCallback(handleExceptions(() -> timeout(attemptContext, ref), attemptContext, executionContext));

        // Update what we should do if the user cancels the execution
        executionContext.setCancelCallback((mayInterrupt) -> {
            ref.abort(mayInterrupt);
            processEndOfAttempt(attemptContext, MethodResult.failure(new CancellationException()));
        }
888446
public static void fire(final HasSummernoteInitHandlers source) {
        if (TYPE != null) {
            SummernoteInitEvent event = new SummernoteInitEvent();
            source.fireEvent(event);
        }
    }
1032064
@Override
	public void onStart(TestContext<Object> context) {
		oldErr = System.err;
		oldOut = System.out;
		try {
			System.setErr(remplacementErr);
			System.setOut(remplacementOut);
		} catch (SecurityException e) {
			// ignored
		}
	}
679450
public static void fire(final HasSummernoteFocusHandlers source) {
        if (TYPE != null) {
            SummernoteFocusEvent event = new SummernoteFocusEvent();
            source.fireEvent(event);
        }
    }