Package reactor.event.selector

Examples of reactor.event.selector.Selector


  @Override
  public <REQ extends Event<?>, RESP extends Event<?>> Reactor sendAndReceive(Object key,
                                                                              REQ ev,
                                                                              Consumer<RESP> reply) {
    Selector sel = Selectors.anonymous();
    on(sel, new SingleUseConsumer<RESP>(reply)).cancelAfterUse();
    notify(key, ev.setReplyTo(sel.getObject()));
    return this;
  }
View Full Code Here


    Collection<ReactorBuilder> pushBuilders =
        grailsEvents.getGroovyEnvironment().reactorBuildersByExtension(EventsPushConstants.TO_BROWSERS);

    Closure broadcastClientFilter;
    Object cursor;
    Selector selector;
    Object key;
    Iterator iterableConfiguration;
    Set<Registration<?>> registrations = new HashSet<Registration<?>>();

    for (ReactorBuilder pushBuilder : pushBuilders) {
      cursor = pushBuilder.ext(EventsPushConstants.TO_BROWSERS);
      if (!Map.class.isAssignableFrom(cursor.getClass()) && !Collection.class.isAssignableFrom(cursor.getClass())) {
        continue;
      }

      iterableConfiguration = Map.class.isAssignableFrom(cursor.getClass()) ?
          ((Map) cursor).entrySet().iterator() :
          ((Collection) cursor).iterator();

      while (iterableConfiguration.hasNext()) {
        cursor = iterableConfiguration.next();
        broadcastClientFilter = null;

        if (Map.Entry.class.isAssignableFrom(cursor.getClass())) {
          key = ((Map.Entry) cursor).getKey();
          if (((Map.Entry) cursor).getValue() != null &&
              Map.class.isAssignableFrom(((Map.Entry) cursor).getValue().getClass())) {
            broadcastClientFilter = (Closure) ((Map) ((Map.Entry) cursor).getValue()).get(CLIENT_FILTER_PARAM);
          }
        } else {
          key = cursor;
        }

        if (key != null) {
          selector = Selector.class.isAssignableFrom(key.getClass()) ?
              (Selector) key :
              Selectors.$(key);

          if (selector.matches(topic)) {
            registrations.add(pushBuilder.get().on(Selectors.$(topic),
                new AtmosphereConsumer(resource, broadcastClientFilter)));
          }
        }
      }
View Full Code Here

TOP

Related Classes of reactor.event.selector.Selector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.