Constructs a new FastEvent instance
@param type the event type
@param manager the bean manager
@param notifier the notifier to be used for observer method resolution
@param qualifiers the event qualifiers
@return
339756
public static <T> FastEvent<T> of(Class<T> type, BeanManagerImpl manager, ObserverNotifier notifier, Annotation... qualifiers) {
        ResolvedObservers<T> resolvedObserverMethods = notifier.<T> resolveObserverMethods(type, qualifiers);
        if (resolvedObserverMethods.isMetadataRequired()) {
            EventMetadata metadata = new EventMetadataImpl(type, null, qualifiers);
            CurrentEventMetadata metadataService = manager.getServices().get(CurrentEventMetadata.class);
            return new FastEventWithMetadataPropagation<T>(resolvedObserverMethods, metadata, metadataService);
        } else {
            return new FastEvent<T>(resolvedObserverMethods);
        }
    }
587606
@Bean(name = AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME)
    ApplicationEventMulticaster applicationEventMulticaster(@Qualifier("asyncExecutor") final Executor executor,
            final TenantAware tenantAware) {
        final SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new TenantAwareApplicationEventPublisher(
                tenantAware, applicationEventFilter());
        simpleApplicationEventMulticaster.setTaskExecutor(executor);
        return simpleApplicationEventMulticaster;
    }
1240989
public static WatchMonitor create(File file, int maxDepth, WatchEvent.Kind<?>... events){
		return create(file.toPath(), maxDepth, events);
	}
1346220
@Bean
    @ConditionalOnMissingBean
    EventEntityManager eventEntityManager(final TenantAware aware, final EntityManager entityManager) {
        return new JpaEventEntityManager(aware, entityManager);
    }
202778
public static <T, X> ObserverMethodImpl<T, X> create(EnhancedAnnotatedMethod<T, ? super X> method, RIBean<X> declaringBean, BeanManagerImpl manager, boolean isAsync) {
        if (declaringBean instanceof ExtensionBean) {
                return new ExtensionObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync);
        }
        return new ObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync);
    }
610164
@Override
	protected Statement childrenInvoker(final RunNotifier notifier) {
		return new Statement() {
			@Override
			public void evaluate() {
				JUnitScenarioReporter junitReporter = new JUnitScenarioReporter(
				notifier, numberOfTestCases, rootDescription, configuration.keywords());
				// tell the reporter how to handle pending steps
				junitReporter.usePendingStepStrategy(configuration
						.pendingStepStrategy());

				addToStoryReporterFormats(junitReporter);

				configurableEmbedder.run();
			}
		};
	}
335968
public final static PipeConnectionEvent build(AbstractPipe source, EventType type, IProvider provider, Map<String, Object> paramMap) {
        return new PipeConnectionEvent(source, type, provider, paramMap);
    }
338649
@Benchmark
  @BenchmarkMode(Mode.AverageTime)
  @OutputTimeUnit(TimeUnit.NANOSECONDS)
  public MessageEvent createMessageEvent(Data data) {
    return MessageEvent.builder(MessageEvent.Type.SENT, MESSAGE_ID).build();
  }
92355
public void afterDeploymentValidation(@Observes @Priority(1) AfterDeploymentValidation event, BeanManager beanManager) {
        BeanManagerImpl manager = BeanManagerProxy.unwrap(beanManager);
        probe.init(manager);
        if (isJMXSupportEnabled(manager)) {
            try {
                MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                mbs.registerMBean(new ProbeDynamicMBean(jsonDataProvider, JsonDataProvider.class), constructProbeJsonDataMBeanName(manager, probe));
            } catch (MalformedObjectNameException | InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) {
                event.addDeploymentProblem(ProbeLogger.LOG.unableToRegisterMBean(JsonDataProvider.class, manager.getContextId(), e));
            }
        }
        addContainerLifecycleEvent(event, null, beanManager);
        exportDataIfNeeded(manager);
    }
350768
public void fireEvent(Type eventType, Object event, Annotation... qualifiers) {
        final EventMetadata metadata = new EventMetadataImpl(eventType, null, qualifiers);
        notifier.fireEvent(eventType, event, metadata, qualifiers);
    }
155323
private void registerNotificationListener(String type, BiConsumer<ObjectName, Tags> perObject) {
        NotificationListener notificationListener = (notification, handback) -> {
            MBeanServerNotification mbs = (MBeanServerNotification) notification;
            ObjectName o = mbs.getMBeanName();
            perObject.accept(o, Tags.concat(tags, nameTag(o)));
        };

        NotificationFilter filter = (NotificationFilter) notification -> {
            if (!MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notification.getType()))
                return false;
            ObjectName obj = ((MBeanServerNotification) notification).getMBeanName();
            return obj.getDomain().equals(JMX_DOMAIN) && obj.getKeyProperty("type").equals(type);
        };

        try {
            mBeanServer.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener, filter, null);
            notificationListenerCleanUpRunnables.add(() -> {
                try {
                    mBeanServer.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener);
                } catch (InstanceNotFoundException | ListenerNotFoundException ignored) {
                }
            });
        } catch (InstanceNotFoundException e) {
            throw new RuntimeException("Error registering Kafka MBean listener", e);
        }
    }
249968
@SuppressWarnings("unchecked")
  public <L, E> EventLog<L, E> getOrCreateEventLog(Class<?> type, String name, Function<EventLog<L, E>, L> listenerFactory) {
    return eventRegistries.computeIfAbsent(type, t -> new ConcurrentHashMap<>())
        .computeIfAbsent(name, n -> new EventLog<>(listenerFactory));
  }
1116204
private void installFastProcessAnnotatedTypeResolver(ServiceRegistry services) {
        ClassFileServices classFileServices = services.get(ClassFileServices.class);
        if (classFileServices != null) {
            final GlobalObserverNotifierService observers = services.get(GlobalObserverNotifierService.class);
            try {
                final FastProcessAnnotatedTypeResolver resolver = new FastProcessAnnotatedTypeResolver(observers.getAllObserverMethods());
                services.add(FastProcessAnnotatedTypeResolver.class, resolver);
            } catch (UnsupportedObserverMethodException e) {
                BootstrapLogger.LOG.notUsingFastResolver(e.getObserver());
                return;
            }
        }
    }
660192
protected @Nonnull <T> T createBean(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) {
        ArgumentUtils.requireNonNull("beanType", beanType);

        Optional<BeanDefinition<T>> concreteCandidate = findConcreteCandidate(beanType, qualifier, true, false);
        if (concreteCandidate.isPresent()) {
            BeanDefinition<T> candidate = concreteCandidate.get();
            if (resolutionContext == null) {
                resolutionContext = new DefaultBeanResolutionContext(this, candidate);
            }
            T createBean = doCreateBean(resolutionContext, candidate, qualifier, false, null);
            if (createBean == null) {
                throw new NoSuchBeanException(beanType);
            }
            return createBean;
        }
        throw new NoSuchBeanException(beanType);
    }
94905
public static TimerJobEntity createTimerEntityForTimerEventDefinition(TimerEventDefinition timerEventDefinition, boolean isInterruptingTimer, 
      ExecutionEntity executionEntity, String jobHandlerType, String jobHandlerConfig) {

    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    
    String businessCalendarRef = null;
    Expression expression = null;
    ExpressionManager expressionManager = processEngineConfiguration.getExpressionManager();
    
    // ACT-1415: timer-declaration on start-event may contain expressions NOT
    // evaluating variables but other context, evaluating should happen nevertheless
    VariableScope scopeForExpression = executionEntity;
    if (scopeForExpression == null) {
      scopeForExpression = NoExecutionVariableScope.getSharedInstance();
    }
    
    if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDate())) {

      businessCalendarRef = DueDateBusinessCalendar.NAME;
      expression = expressionManager.createExpression(timerEventDefinition.getTimeDate());

    } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeCycle())) {

      businessCalendarRef = CycleBusinessCalendar.NAME;
      expression = expressionManager.createExpression(timerEventDefinition.getTimeCycle());

    } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDuration())) {

      businessCalendarRef = DurationBusinessCalendar.NAME;
      expression = expressionManager.createExpression(timerEventDefinition.getTimeDuration());
    }
    
    if (StringUtils.isNotEmpty(timerEventDefinition.getCalendarName())) {
      businessCalendarRef = timerEventDefinition.getCalendarName();
      Expression businessCalendarExpression = expressionManager.createExpression(businessCalendarRef);
      businessCalendarRef = businessCalendarExpression.getValue(scopeForExpression).toString();
    }

    if (expression == null) {
      throw new ActivitiException("Timer needs configuration (either timeDate, timeCycle or timeDuration is needed) (" + timerEventDefinition.getId() + ")");
    }

    BusinessCalendar businessCalendar = processEngineConfiguration.getBusinessCalendarManager().getBusinessCalendar(businessCalendarRef);

    String dueDateString = null;
    Date duedate = null;
    
    Object dueDateValue = expression.getValue(scopeForExpression);
    if (dueDateValue instanceof String) {
      dueDateString = (String) dueDateValue;
      
    } else if (dueDateValue instanceof Date) {
      duedate = (Date) dueDateValue;
      
    } else if (dueDateValue instanceof DateTime) {
      //JodaTime support
      duedate = ((DateTime) dueDateValue).toDate();
      
    } else if (dueDateValue != null) {
      throw new ActivitiException("Timer '" + executionEntity.getActivityId()
          + "' was not configured with a valid duration/time, either hand in a java.util.Date or a String in format 'yyyy-MM-dd'T'hh:mm:ss'");
    }
    
    if (duedate == null && dueDateString != null) {
      duedate = businessCalendar.resolveDuedate(dueDateString);
    }

    TimerJobEntity timer = null;
    if (duedate != null) {
      timer = Context.getCommandContext().getTimerJobEntityManager().create();
      timer.setJobType(JobEntity.JOB_TYPE_TIMER);
      timer.setRevision(1);
      timer.setJobHandlerType(jobHandlerType);
      timer.setJobHandlerConfiguration(jobHandlerConfig);
      timer.setExclusive(true);
      timer.setRetries(processEngineConfiguration.getAsyncExecutorNumberOfRetries());
      timer.setDuedate(duedate);
      if (executionEntity != null) {
        timer.setExecution(executionEntity);
        timer.setProcessDefinitionId(executionEntity.getProcessDefinitionId());
        timer.setProcessInstanceId(executionEntity.getProcessInstanceId());

        // Inherit tenant identifier (if applicable)
        if (executionEntity.getTenantId() != null) {
          timer.setTenantId(executionEntity.getTenantId());
        }
      }
    }

    if (StringUtils.isNotEmpty(timerEventDefinition.getTimeCycle())) {
      // See ACT-1427: A boundary timer with a cancelActivity='true', doesn't need to repeat itself
      boolean repeat = !isInterruptingTimer;

      // ACT-1951: intermediate catching timer events shouldn't repeat according to spec
      if (executionEntity != null) {
        FlowElement currentElement = executionEntity.getCurrentFlowElement();
        if (currentElement instanceof IntermediateCatchEvent) {
          repeat = false;
        }
      }

      if (repeat) {
        String prepared = prepareRepeat(dueDateString);
        timer.setRepeat(prepared);
      }
    }

    if (timer != null && executionEntity != null) {
      timer.setExecution(executionEntity);
      timer.setProcessDefinitionId(executionEntity.getProcessDefinitionId());

      // Inherit tenant identifier (if applicable)
      if (executionEntity.getTenantId() != null) {
        timer.setTenantId(executionEntity.getTenantId());
      }
    }

    return timer;
  }
215463
public static <T> Qualifier<T> byAnnotation(AnnotationMetadata metadata, Class<? extends Annotation> type) {
        if (Type.class == type) {
            Optional<Class> aClass = metadata.classValue(type);
            if (aClass.isPresent()) {
                return byType(aClass.get());
            }
        } else if (Named.class == type) {
            Optional<String> value = metadata.getValue(type, String.class);
            if (value.isPresent()) {
                return byName(value.get());
            }
        }
        return new AnnotationMetadataQualifier<>(metadata, type);
    }
323161
public static InternalEvent createActivityNotifyMessage(ActivityInstance ai,
            Integer eventType, String masterRequestId, String compCode) {
        InternalEvent event = new InternalEvent();
        event.workId = ai.getActivityId();
        event.transitionInstanceId = null;
        event.eventType = eventType;
        event.ownerType = OwnerType.PROCESS_INSTANCE;
        event.ownerId = ai.getProcessInstanceId();
        event.masterRequestId = masterRequestId;
        event.workInstanceId = ai.getId();
        event.completionCode = compCode;
        return event;
    }