Creates an async instant trace event. This method does not queue the
event. Call {@link TraceEventBatch#add(Supplier)} to queue the event.
342397
public static TraceEvent instantAsync(String name, Object id, Object... args) {
        return new TraceEvent(TraceEventType.ASYNC_INSTANT, name, String.valueOf(id), args);
    }
1053197
private static DisruptorEventQueue create() {
    // Create new Disruptor for processing. Note that Disruptor creates a single thread per
    // consumer (see https://github.com/LMAX-Exchange/disruptor/issues/121 for details);
    // this ensures that the event handler can take unsynchronized actions whenever possible.
    Disruptor<DisruptorEvent> disruptor =
        new Disruptor<>(
            DisruptorEventFactory.INSTANCE,
            DISRUPTOR_BUFFER_SIZE,
            new DaemonThreadFactory("OpenCensus.Disruptor"),
            ProducerType.MULTI,
            new SleepingWaitStrategy(0, 1000 * 1000));
    disruptor.handleEventsWith(new DisruptorEventHandler[] {DisruptorEventHandler.INSTANCE});
    disruptor.start();
    final RingBuffer<DisruptorEvent> ringBuffer = disruptor.getRingBuffer();

    DisruptorEnqueuer enqueuer =
        new DisruptorEnqueuer() {
          @Override
          public void enqueue(Entry entry) {
            long sequence = ringBuffer.next();
            try {
              DisruptorEvent event = ringBuffer.get(sequence);
              event.setEntry(entry);
            } finally {
              ringBuffer.publish(sequence);
            }
          }
        };
    return new DisruptorEventQueue(disruptor, enqueuer);
  }
1099273
public static TestCaseStartedEvent withExecutorInfo(TestCaseStartedEvent event) {
        event.getLabels().add(createHostLabel(getHostname()));
        event.getLabels().add(createThreadLabel(format("%s.%s(%s)",
                        ManagementFactory.getRuntimeMXBean().getName(),
                        Thread.currentThread().getName(),
                        Thread.currentThread().getId())
        ));
        return event;
    }
1021090
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier,
            Executor executor) {
        return CompletableFuture
                .supplyAsync(handleSupplierWithException(supplier), executor);
    }
1297592
public static <T> Supplier<T> synchronizedSupplier(Supplier<T> delegate) {
    return new ThreadSafeSupplier<T>(Preconditions.checkNotNull(delegate));
  }
358467
public void deliverAsyncException(Throwable e)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "deliverAsyncException", e);

      if (proxyQueue != null)
      {
         proxyQueue.deliverException(e);
      }
      else
      {
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "** Odd - we are not async?!");
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "deliverAsyncException");
   }
1309756
public static Function<Client<HttpRequest, HttpResponse>, HttpTracingClient> newDecorator(Tracing tracing) {
        return newDecorator(tracing, null);
    }
116692
public static synchronized IAsyncProvider createInstance() throws AsyncException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "createInstance");
        }

        if (instance == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "instance is null.  Instantiating new AsyncLibrary ");
            }
            instance = new AsyncLibrary();
        }

        if ((aioInitialized == AIO_NOT_INITIALIZED) || (aioInitialized == AIO_SHUTDOWN)) {
            initialize();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "createInstance");
        }

        return instance;
    }
1325368
function addEventSource(source) {
		source = _addEventSource(source);
		if (source) {
			pendingSourceCnt++;
			fetchEventSource(source, currentFetchID); // will eventually call reportEvents
		}
	}
269807
public void addEventToReportingQueue(GobblinTrackingEvent event) {
    if (this.reportingQueue.size() > QUEUE_CAPACITY * 2 / 3) {
      immediatelyScheduleReport();
    }
    try {
      if (!this.reportingQueue.offer(sanitizeEvent(event), 10, TimeUnit.SECONDS)) {
        log.error("Enqueuing of event {} at reporter with class {} timed out. Sending of events is probably stuck.",
            event, this.getClass().getCanonicalName());
      }
    } catch (InterruptedException ie) {
      log.warn("Enqueuing of event {} at reporter with class {} was interrupted.", event,
          this.getClass().getCanonicalName(), ie);
    }
  }
368366
public static TraceEvent endAsync(String name, Object id, Object... args) {
        return new TraceEvent(TraceEventType.ASYNC_END, name, String.valueOf(id), args);
    }
598267
private Handler<AsyncResult<String>> createDeploymentHandler(final Message<JsonObject> message) {
    return new Handler<AsyncResult<String>>() {
      @Override
      public void handle(AsyncResult<String> result) {
        if (result.failed()) {
          message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
        } else {
          addNewDeployment(result.result(), message.body(), new Handler<AsyncResult<String>>() {
            @Override
            public void handle(AsyncResult<String> result) {
              message.reply(new JsonObject().putString("status", "ok").putString("id", result.result()));
            }
          });
        }
      }
    };
  }
1157346
@Override
    public <T extends Event<?>> T add(T event, Channel... channels) {
        ((EventBase<?>) event).generatedBy(newEventsParent.get());
        ((EventBase<?>) event).processedBy(this);
        synchronized (queue) {
            queue.add(event, channels);
        }
        if (isRunning) {
            return event;
        }
        isRunning = true;
        GeneratorRegistry.instance().add(this);
        run();
        isRunning = false;
        return event;
    }
497942
protected void addANYHandler(final EventHandler eventHandler)
	{
		final int eventType = eventHandler.getEventType();
		if (eventType != Events.ANY)
		{
			LOG.error("The incoming handler {} is not of type ANY",
					eventHandler);
			throw new IllegalArgumentException(
					"The incoming handler is not of type ANY");
		}
		anyHandler.add(eventHandler);
		Callback<List<Event>> eventCallback = createEventCallbackForHandler(eventHandler);
		BatchSubscriber<Event> batchEventSubscriber = new BatchSubscriber<Event>(
				fiber, eventCallback, 0, TimeUnit.MILLISECONDS);
		Disposable disposable = eventQueue.subscribe(batchEventSubscriber);
		disposableHandlerMap.put(eventHandler, disposable);
	}
833336
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {
        return CompletableFuture
                .supplyAsync(handleSupplierWithException(supplier));
    }
939221
@Override
    public java.util.concurrent.Future<CreateStreamResult> createStreamAsync(String streamName, Integer shardCount,
            com.amazonaws.handlers.AsyncHandler<CreateStreamRequest, CreateStreamResult> asyncHandler) {

        return createStreamAsync(new CreateStreamRequest().withStreamName(streamName).withShardCount(shardCount), asyncHandler);
    }
777926
public synchronized AsynchConsumerProxyQueue createOrderedProxyQueue(OrderingContext context,
                                                                        short id,
                                                                        short seqNumber)
      throws SIResourceException, SIIncorrectCallException
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createOrderedProxyQueue", context);
      
      checkClosed();
      
      AsynchConsumerProxyQueue proxyQueue = new OrderedSessionProxyQueueImpl(this, 
                                                                             id, 
                                                                             conversation, 
                                                                             context);
      idToProxyQueueMap.put(new ImmutableId(id), proxyQueue);
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createOrderedProxyQueue", proxyQueue);
      return proxyQueue;
   }