Publish the specified event to all registered handlers that have an
interest in the event topic.

@param event
the Liberty <code>Event</code> to deliver
@param async
<code>true</code> if the event delivery can be done asynchronously
@return EventImpl
760729
public EventImpl publishEvent(Event event, boolean async) {
        EventImpl eventImpl = (EventImpl) event;
        eventImpl.setReadOnly(true);
        EventImpl currentEvent = (EventImpl) CurrentEvent.get();
        if (null != currentEvent) {
            eventImpl.setParent(currentEvent);
        }

        // Attempt to get the Topic object and cached TopicData but fallback
        // to the topic name if the Topic object wasn't populated
        Topic topic = eventImpl.getTopicObject();
        String topicName = topic != null ? topic.getName() : eventImpl.getTopic();
        TopicData topicData = topicCache.getTopicData(topic, topicName);
        eventImpl.setTopicData(topicData);

        // Required Java 2 Security check
        checkTopicPublishPermission(topicName);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Publishing Event", topicName);
        }

        // Obtain list of matching handlers: returned list of handlers
        // must be thread safe!
        List<HandlerHolder> holders = topicData.getEventHandlers();
        ExecutorService executor = topicData.getExecutorService();

        if (async) {
            int i = 0;
            // Handle asynchronous events.
            Future<?>[] futures = new Future<?>[holders.size()];
            for (HandlerHolder holder : holders) {
                holder.addEvent(eventImpl);
                futures[i++] = queueWorkRequest(holder, executor);
            }
            eventImpl.setFutures(futures);
        } else {
            // fire synchronous events
            for (HandlerHolder holder : holders) {
                holder.fireSynchronousEvent(eventImpl);
            }
        }

        return eventImpl;
    }
380557
public synchronized <Q extends T> void dispatchAsynchronous(final Q event, final IPostProcessor<Q> pPostProcessor) {

		new Thread(new Runnable() {

			@Override
			public void run() {

				try {

					// delegate dispatch result
					pPostProcessor.done(dispatch(event));

				} catch (DispatchException lEx) {

					// delegate exception handling as well
					pPostProcessor.done(lEx);

				}
			}
		}).start();

	}
1312729
@Override
    public java.util.concurrent.Future<ListEventSourceMappingsResult> listEventSourceMappingsAsync(
            com.amazonaws.handlers.AsyncHandler<ListEventSourceMappingsRequest, ListEventSourceMappingsResult> asyncHandler) {

        return listEventSourceMappingsAsync(new ListEventSourceMappingsRequest(), asyncHandler);
    }
332082
@Override
    public AsyncAuditOutputStream write(AuditEvent event) {
        if (event instanceof AnnotationAuditEvent) {
            annotationStream.write((AnnotationAuditEvent) event);
        } else {
            deferred.accept(event);
            b.await();
        }
        
        return this;
    }
295153
public EventBus emitSync(String event, Object... args) {
        return _emitWithOnceBus(eventContextSync(event, args));
    }
359533
async def emit_event(self, event):
        
        self.log.info("publishing event on %s", self.publish_topic)
        if self.config.extra['config']['pub_options']['retain']:
            try:
                await persist_event(
                    self.publish_topic,
                    event,
                    self.pool
                )
            except SystemError as error:
                self.log.error(error)
                return

        await asyncio.sleep(1)
597534
@Nullable
  public static Object triggerSynchronous (@Nonnull final IEvent aEvent)
  {
    ValueEnforcer.notNull (aEvent, "Event");

    final ICommonsList <Object> aRetValues = new CommonsArrayList <> ();
    // for all scopes
    for (final EScope eCurrentScope : EScope.values ())
    {
      // get current instance of scope
      final IScope aScope = _getScope (eCurrentScope, false);
      if (aScope != null)
      {
        // get event manager (may be null)
        final InternalScopedEventManager aEventMgr = _getEventMgr (aScope);
        if (aEventMgr != null)
        {
          // main event trigger
          aRetValues.add (aEventMgr.triggerSynchronous (aEvent));
        }
      }
    }
    return aEvent.getResultAggregator ().apply (aRetValues);
  }
605089
@Override
    public java.util.concurrent.Future<DescribeApplicationsResult> describeApplicationsAsync(
            com.amazonaws.handlers.AsyncHandler<DescribeApplicationsRequest, DescribeApplicationsResult> asyncHandler) {

        return describeApplicationsAsync(new DescribeApplicationsRequest(), asyncHandler);
    }
1200438
@Override
    public java.util.concurrent.Future<DescribeConnectionsResult> describeConnectionsAsync(
            com.amazonaws.handlers.AsyncHandler<DescribeConnectionsRequest, DescribeConnectionsResult> asyncHandler) {

        return describeConnectionsAsync(new DescribeConnectionsRequest(), asyncHandler);
    }
1209346
public void publishEvent(final ApplicationEvent event) {
        if (this.eventPublisher != null) {
            LOGGER.trace("Publishing event [{}]", event);
            this.eventPublisher.publishEvent(event);
        }
    }
467073
@Override
    public java.util.concurrent.Future<PublishResult> publishAsync(String topicArn, String message, String subject) {

        return publishAsync(new PublishRequest().withTopicArn(topicArn).withMessage(message).withSubject(subject));
    }
99607
public EventBus emitAsync(Enum<?> event, Object... args) {
        return _emitWithOnceBus(eventContextAsync(event, args));
    }
725618
@Override
    public java.util.concurrent.Future<SubscribeResult> subscribeAsync(String topicArn, String protocol, String endpoint,
            com.amazonaws.handlers.AsyncHandler<SubscribeRequest, SubscribeResult> asyncHandler) {

        return subscribeAsync(new SubscribeRequest().withTopicArn(topicArn).withProtocol(protocol).withEndpoint(endpoint), asyncHandler);
    }
444301
public void publish(Object event) {
        Objects.requireNonNull(event, Required.EVENT.toString());
        
        this.eventBus.post(event);
        this.events.getAndIncrement();
    }
664348
public static <T> Flowable<T> toFlowable(EventPublisher<T> eventPublisher) {
        PublishProcessor<T> publishProcessor = PublishProcessor.create();
        FlowableProcessor<T> flowableProcessor = publishProcessor.toSerialized();
        eventPublisher.onEvent(flowableProcessor::onNext);
        return flowableProcessor;
    }
207320
async function (events) {
    const oThis = this
      , promiseArray = []
    ;

    // nothing to do
    if (!events || events.length === 0) {
      oThis.updateIntercomDataFile();
      return Promise.resolve();
    }

    //TODO: last processed transaction index.
    for (var i = 0; i < events.length; i++) {
      const eventObj = events[i]
        , j = i
      ;

      // await oThis.processEventObj(eventObj);

      if (oThis.parallelProcessingAllowed()) {
        promiseArray.push(new Promise(function (onResolve, onReject) {
          setTimeout(function () {
            oThis.processEventObj(eventObj)
              .then(onResolve)
              .catch(function (error) {
                logger.error('##### inside catch block #####: ', error);
                return onResolve();
              });
          }, (j * 1000 + 100));
        }));
      } else {
        await oThis.processEventObj(eventObj)
          .catch(function (error) {
            logger.error('inside catch block: ', error);
            return Promise.resolve();
          });
      }
    }

    if (oThis.parallelProcessingAllowed()) {
      await Promise.all(promiseArray);
    }

    oThis.updateIntercomDataFile();
    return Promise.resolve();
  }
544113
public EventBus emitAsync(ActEvent event, Object... args) {
        return _emitWithOnceBus(eventContextAsync(event, args));
    }