Sends an asynchronous create events (batch) request to the API.

@param events a List of {@link Event} that will be turned into a request
545258
public FutureAPIResponse createEventsAsFuture(List<Event> events) throws IOException {
    RequestBuilder builder = new RequestBuilder("POST");
    builder.setUrl(apiUrl + "/batch/events.json?accessKey=" + accessKey);

    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.registerTypeAdapter(DateTime.class, new DateTimeAdapter());
    Gson gson = gsonBuilder.create();
    String requestJsonString = gson.toJson(events);

    builder.setBody(requestJsonString);
    builder.setHeader("Content-Type", "application/json");
    builder.setHeader("Content-Length", "" + requestJsonString.length());
    return new FutureAPIResponse(client.executeRequest(builder.build(), getHandler()));
  }
101151
public void sendEvent(final Map<String, String> params) {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                // put user id
                params.put("cid", userId);
                Multimap queryParams = HashMultimap.create();
                for (Map.Entry<String, String> entry : params.entrySet()) {
                    String key = entry.getKey();
                    String value = entry.getValue();
                    Preconditions.checkNotNull(key, "Custom search param key must not be null.");
                    Preconditions.checkNotNull(value, "Custom search param value must not be null.");
                    queryParams.put(key, value);
                }
                viSearchHttpClient.get(ENDPOINT_SEND_ACTIONS, queryParams);
            }
        });
    }
1312729
@Override
    public java.util.concurrent.Future<ListEventSourceMappingsResult> listEventSourceMappingsAsync(
            com.amazonaws.handlers.AsyncHandler<ListEventSourceMappingsRequest, ListEventSourceMappingsResult> asyncHandler) {

        return listEventSourceMappingsAsync(new ListEventSourceMappingsRequest(), asyncHandler);
    }
496725
public void fire(T event) {
		ArrayList<Listener<T>> list1;
		ArrayList<Runnable> list2;
		synchronized (this) {
			if (listeners == null) list1 = null;
			else list1 = new ArrayList<>(listeners);
			if (listenersRunnable == null) list2 = null;
			else list2 = new ArrayList<>(listenersRunnable);
		}
		if (list1 != null)
			for (int i = 0; i < list1.size(); ++i)
				try { list1.get(i).fire(event); }
				catch (Throwable t) {
					LCCore.getApplication().getDefaultLogger().error("Event listener error: " + list1.get(i), t);
				}
		if (list2 != null)
			for (int i = 0; i < list2.size(); ++i)
				try { list2.get(i).run(); }
				catch (Throwable t) {
					LCCore.getApplication().getDefaultLogger().error("Event listener error: " + list2.get(i), t);
				}
	}
195039
public void processEvent(EventObject event) {
    if (event instanceof RequestEvent) {
      processRequest((RequestEvent) event);
    } else if (event instanceof ResponseEvent) {
      processResponse((ResponseEvent) event);
    } else if (event instanceof TimeoutEvent) {
      processTimeout((TimeoutEvent) event);
    } else {
      LOG.error("invalid event type received: {}: {}", event.getClass().getName(), event.toString());
    }
  }
670494
public static Optional<BatchStartedEvent> parse(Event event) {
        Matcher matcher = PATTERN.matcher(event.getTag());
        if (matcher.matches()) {
            return Optional.of(new BatchStartedEvent(matcher.group(1), event.getData(Data.class)));
        }
        return Optional.empty();
    }
338356
@SuppressWarnings("unchecked")
	@Override
	public void publishEvent(ApplicationEvent event) {

		if (event instanceof MappingContextEvent) {
			this.schmeaCreator
					.onApplicationEvent((MappingContextEvent<SolrPersistentEntity<?>, SolrPersistentProperty>) event);
		}
	}
880023
public void sendEvent(EventBuilder eventBuilder) {
        if (!Util.isNullOrEmpty(release)) {
            eventBuilder.withRelease(release.trim());
            if (!Util.isNullOrEmpty(dist)) {
                eventBuilder.withDist(dist.trim());
            }
        }

        if (!Util.isNullOrEmpty(environment)) {
            eventBuilder.withEnvironment(environment.trim());
        }

        if (!Util.isNullOrEmpty(serverName)) {
            eventBuilder.withServerName(serverName.trim());
        }

        for (Map.Entry<String, String> tagEntry : tags.entrySet()) {
            eventBuilder.withTag(tagEntry.getKey(), tagEntry.getValue());
        }

        for (Map.Entry<String, Object> extraEntry : extra.entrySet()) {
            eventBuilder.withExtra(extraEntry.getKey(), extraEntry.getValue());
        }

        runBuilderHelpers(eventBuilder);
        Event event = eventBuilder.build();
        sendEvent(event);
    }
463568
public void batch(List<? extends Row> actions, @Nullable Object[] results)
      throws IOException, InterruptedException {
    if (results == null) {
      results = new Object[actions.size()];
    }
    batchCallback(actions, results, null);
  }
1209346
public void publishEvent(final ApplicationEvent event) {
        if (this.eventPublisher != null) {
            LOGGER.trace("Publishing event [{}]", event);
            this.eventPublisher.publishEvent(event);
        }
    }
1372976
public void postEvent (DEvent event)
    {
        if (!_running) {
            log.warning("Posting message to inactive object manager", "event", event,
                        new Exception());
        }

        // assign the event's id and append it to the queue
        event.eventId = getNextEventId(true);
        _evqueue.append(event);
    }
132756
void publishOsgiEvent(org.osgi.service.event.Event event, boolean async) {
        String topic = event.getTopic();
        com.ibm.websphere.event.Event e = createEvent(topic);
        for (String key : event.getPropertyNames()) {
            e.setProperty(key, event.getProperty(key));
        }
        publishEvent(e, async);
    }
227115
@Override
    public void onEvent(Object event, long sequence, boolean endOfBatch) throws Exception {
        if (event == null) {
            return;
        }
        handleEvent(event, endOfBatch);
    }
819151
@Override
    public void onEvent(final WorkerEvent event, final Worker worker, final String queue,
            final net.greghaines.jesque.Job job, final Object runner, final Object result, final Throwable t) {
        if (t == null) {
            LOG.debug("{} {} {} {} {} {} {}", new Object[]{ event, worker, queue, job, runner, result, t });
        } else {
            LOG.error(event + " " + worker + " " + queue + " " + job + " " + runner + " " + result, t);
        }
    }
1267800
public void append(final List<Event> events) {
        if (events != null && events.size() > 0) {
            this.events.addAll(events);
        }
    }
1105780
public void setServerEvents(java.util.Collection<ServerEvent> serverEvents) {
        if (serverEvents == null) {
            this.serverEvents = null;
            return;
        }

        this.serverEvents = new java.util.ArrayList<ServerEvent>(serverEvents);
    }
838680
@Override
  public void onNext(final T event) {
    LOG.log(Level.FINEST, "Invoked for event: {0}", event);
    lock.readLock().lock();
    final List<EventHandler<? extends T>> list;
    try {
      list = clazzToListOfHandlersMap.get(event.getClass());
      if (list == null) {
        throw new WakeRuntimeException("No event " + event.getClass() + " handler");
      }
      for (final EventHandler<? extends T> handler : list) {
        LOG.log(Level.FINEST, "Invoking {0}", handler);
        ((EventHandler<T>) handler).onNext(event);
      }
    } finally {
      lock.readLock().unlock();
    }
  }