Sends an asynchronous create event request to the API.

@param event an instance of {@link Event} that will be turned into a request
328108
public FutureAPIResponse createEventAsFuture(Event event) throws IOException {
    RequestBuilder builder = new RequestBuilder("POST");
    builder.setUrl(apiUrl + "/events.json?accessKey=" + accessKey);
    String requestJsonString = event.toJsonString();
    builder.setBody(requestJsonString);
    builder.setHeader("Content-Type", "application/json");
    builder.setHeader("Content-Length", "" + requestJsonString.length());
    return new FutureAPIResponse(client.executeRequest(builder.build(), getHandler()));
  }
394346
function sendEvent(event) {
  var message = JSON.stringify(event);

  console.log('ws -> send: ' + message);

  var clients = serverMode ? wss.clients : [ws];

  for (var i = 0; i < clients.length; i++) {
    clients[i].send(message);
  }
}
684067
public void sessionCreated(final HttpSessionEvent event) {
		counter++;
		final HttpSession session = event.getSession();
		final String id = session.getId();
		SESSIONS.put(id, session);
	}
446421
protected AjaxEventBehavior newAjaxEventBehavior(final String event)
	{
		return new AjaxEventBehavior(event)
		{
			private static final long serialVersionUID = 1L;

			@Override
			protected void onEvent(final AjaxRequestTarget target)
			{
				final RadioGroup<T> radioGroup = getGroup();
				radioGroup.processInput();
				onClick(target);
			}

			@Override
			protected void updateAjaxAttributes(final AjaxRequestAttributes attributes)
			{
				super.updateAjaxAttributes(attributes);
				AjaxRadio.this.updateAjaxAttributes(attributes);
			}
		};
	}
492228
void deliverAsyncEvent(final EntryEvent<K,V> _event) {
    if (asyncListenerByType.get(_event.getEventType()).isEmpty()) {
      return;
    }
    List<Listener<K,V>> _listeners =
      new ArrayList<Listener<K, V>>(asyncListenerByType.get(_event.getEventType()));
    if (_listeners.isEmpty()) {
      return;
    }
    K key = _event.getKey();
    synchronized (getLockObject(key)) {
      Queue<EntryEvent<K,V>> q = keyQueue.get(key);
      if (q != null) {
        q.add(_event);
        return;
      }
      q = new LinkedList<EntryEvent<K, V>>();
      keyQueue.put(key, q);
    }
    runAllListenersInParallel(_event, _listeners);
  }
355903
def add_event(self, event):
        
        if not isinstance(event, event_pb2.Event):
            raise TypeError("Expected an event_pb2.Event proto, "
                            " but got %s" % type(event))
        self._async_writer.write(event.SerializeToString())
593192
@Override
    public <P> void pojoDaoCreated(PojoDaoFactoryEvent<P> event) {
        String tableName = event.getTableName();
        Schema schema = new Schema();
        event.getPojoBinding().describe(schema.createTable(tableName), schema);

        schema.items().forEach(schemaItem -> {
            final String key = schemaItem.getKey();
            final String claimId = UUID.randomUUID().toString();
            session.execute(insertStatement.bind(key, claimId));
            Row row = session.execute(selectStatement.bind(key)).one();
            if (StringUtils.equals(claimId, row.getString(0))) {
                final SchemaStatement statement = schemaItem.createStatement();
                LOGGER.info("Creating table(s) to support \"{}\":\n\t{}\n", event.getPojoBinding().getPojoType().getSimpleName(), statement);
                session.execute(statement);
            }
        });
    }
444301
public void publish(Object event) {
        Objects.requireNonNull(event, Required.EVENT.toString());
        
        this.eventBus.post(event);
        this.events.getAndIncrement();
    }
701895
public void processEvent(EventObject event) {
    if (event instanceof RequestEvent) {
      processRequestEvent((RequestEvent) event);
    } else {
      LOG.error("invalid event type received: " + event.getClass().getName() + ": "
          + event.toString());
    }
  }
1173323
@RequestHandler(dynamic = true)
    public void onRequest(Request.In event) {
        if (event.associated(Session.class).isPresent()) {
            return;
        }
        final HttpRequest request = event.httpRequest();
        Optional<String> requestedSessionId = request.findValue(
            HttpField.COOKIE, Converters.COOKIE_LIST)
            .flatMap(cookies -> cookies.stream().filter(
                cookie -> cookie.getName().equals(idName()))
                .findFirst().map(HttpCookie::getValue));
        if (requestedSessionId.isPresent()) {
            String sessionId = requestedSessionId.get();
            synchronized (this) {
                Optional<Session> session = lookupSession(sessionId);
                if (session.isPresent()) {
                    Instant now = Instant.now();
                    if ((absoluteTimeout <= 0
                        || Duration.between(session.get().createdAt(),
                            now).toMillis() < absoluteTimeout)
                        && (idleTimeout <= 0
                            || Duration.between(session.get().lastUsedAt(),
                                now).toMillis() < idleTimeout)) {
                        event.setAssociated(Session.class, session.get());
                        session.get().updateLastUsedAt();
                        return;
                    }
                    // Invalidate, too old
                    removeSession(sessionId);
                }
            }
        }
        String sessionId = createSessionId(request.response().get());
        Session session = createSession(sessionId);
        event.setAssociated(Session.class, session);
    }
332082
@Override
    public AsyncAuditOutputStream write(AuditEvent event) {
        if (event instanceof AnnotationAuditEvent) {
            annotationStream.write((AnnotationAuditEvent) event);
        } else {
            deferred.accept(event);
            b.await();
        }
        
        return this;
    }
538911
@Override
  public synchronized void handleEvent(final Event event) {
    if (event.getType() == EventType.FLOW_FINISHED) {
      final FlowRunner runner = (FlowRunner) event.getRunner();
      if (runner != null && runner.getExecutableFlow().getStatus().equals(Status.FAILED)) {
        this.value = this.value + 1;
      }
    }
  }
297828
public void append(final T event) {

		// make sure we can append the log message

		if (backgroundService == null) {
			return;
		}

		if (!backgroundService.isRunning()) {
			return;
		}

		// skip internal logging
		
		if (!allowComDotStackify) {
			String className = eventAdapter.getClassName(event);
			
			if (className != null) {
				if (className.startsWith(COM_DOT_STACKIFY)) {
					return;
				}
			}
		}
		
		// build the log message and queue it to be sent to Stackify

		Throwable exception = eventAdapter.getThrowable(event);

		StackifyError error = null;

		if ((exception != null) || (eventAdapter.isErrorLevel(event))) {
			StackifyError e = eventAdapter.getStackifyError(event, exception);

			if (errorGovernor.errorShouldBeSent(e)) {
				error = e;
			}
		}

		LogMsg logMsg = eventAdapter.getLogMsg(event, error);

		collector.addLogMsg(logMsg);
	}
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();
    }
  }
815161
@Override
    public void add(Event event) {
        if (getNumStoredEvents() >= maxEvents) {
            logger.warn("Not adding Event because at least "
                + Integer.toString(maxEvents) + " events are already stored: " + event.getId());
            return;
        }

        File eventFile = new File(bufferDir.getAbsolutePath(), event.getId().toString() + FILE_SUFFIX);
        if (eventFile.exists()) {
            logger.trace("Not adding Event to offline storage because it already exists: "
                + eventFile.getAbsolutePath());
            return;
        } else {
            logger.debug("Adding Event to offline storage: " + eventFile.getAbsolutePath());
        }

        try (FileOutputStream fileOutputStream = new FileOutputStream(eventFile);
             ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream)) {
            objectOutputStream.writeObject(event);
        } catch (Exception e) {
            logger.error("Error writing Event to offline storage: " + event.getId(), e);
        }

        logger.debug(Integer.toString(getNumStoredEvents())
            + " stored events are now in dir: "
            + bufferDir.getAbsolutePath());
    }
54137
@Override
  public synchronized void handleEvent(final Event event) {
    if (event.getType() == EventType.JOB_STARTED) {
      this.value = this.value + 1;
    } else if (event.getType() == EventType.JOB_FINISHED) {
      this.value = this.value - 1;
    }
  }
218118
public void addEvent(FlowEvent event) throws IOException {
    Put p = createPutForEvent(event);
    Table eventTable = null;
    try {
      eventTable = hbaseConnection
          .getTable(TableName.valueOf(Constants.FLOW_EVENT_TABLE));
      eventTable.put(p);
    } finally {
      if (eventTable != null) {
        eventTable.close();
      }
    }
  }