Esempio n. 1
0
  private <H> void doFire(RemoteEvent<H> event, int uuid) {
    if (event == null) {
      throw new NullPointerException("Cannot fire null event");
    }
    try {
      firingDepth++;

      if (uuid != 0) {
        setSourceUuidOfEvent(event, uuid);
      }

      setEventBusUuidOfEvent(event, getUUID());

      List<H> handlers = getDispatchList(event.getAssociatedType(), uuid);
      Set<Throwable> causes = null;

      ListIterator<H> it = handlers.listIterator();
      while (it.hasNext()) {
        H handler = it.next();

        try {
          dispatchEvent(event, handler);
        } catch (Throwable e) {
          if (causes == null) {
            causes = new HashSet<Throwable>();
          }
          causes.add(e);
        }
      }

      if (causes != null) {
        throw new UmbrellaException(causes);
      }
    } finally {
      firingDepth--;
      if (firingDepth == 0) {
        handleQueuedAddsAndRemoves();
      }
    }
  }
Esempio n. 2
0
 protected static void setEventBusUuidOfEvent(RemoteEvent<?> event, long eventBusUUID) {
   event.setEventBusUUID(eventBusUUID);
 }
Esempio n. 3
0
 protected static void setSourceUuidOfEvent(RemoteEvent<?> event, int uuid) {
   event.setSourceUUID(uuid);
 }
Esempio n. 4
0
 protected static <H> void dispatchEvent(RemoteEvent<H> event, H handler) {
   event.dispatch(handler);
 }