Package org.vertx.java.core.eventbus.impl

Examples of org.vertx.java.core.eventbus.impl.ServerIDs


  public void entryAdded(EntryEvent<String, HazelcastServerID> entry) {
    addEntry(entry.getKey(), entry.getValue().serverID);
  }

  private void addEntry(String key, ServerID value) {
    ServerIDs entries = cache.get(key);
    if (entries == null) {
      entries = new ServerIDs(1);
      ServerIDs prev = cache.putIfAbsent(key, entries);
      if (prev != null) {
        entries = prev;
      }
    }
    entries.add(value);
View Full Code Here


  public void entryRemoved(EntryEvent<String, HazelcastServerID> entry) {
    removeEntry(entry.getKey(), entry.getValue().serverID);
  }

  private void removeEntry(String key, ServerID value) {
    ServerIDs entries = cache.get(key);
    if (entries != null) {
      entries.remove(value);
      if (entries.isEmpty()) {
        cache.remove(key);
      }
    }
  }
View Full Code Here

  }

  @Override
  public void entryUpdated(EntryEvent<String, HazelcastServerID> entry) {
    String key = entry.getKey();
    ServerIDs entries = cache.get(key);
    if (entries != null) {
      entries.add(entry.getValue().serverID);
    }
  }
View Full Code Here

    }.run();
  }

  @Override
  public void get(final String subName, final Handler<AsyncResult<ServerIDs>> completionHandler) {
    ServerIDs entries = cache.get(subName);
    DefaultFutureResult<ServerIDs> result = new DefaultFutureResult<>();
    if (entries != null && entries.isInitialised()) {
      result.setResult(entries).setHandler(completionHandler);
    } else {
      new BlockingAction<Collection<HazelcastServerID>>(vertx, new AsyncResultHandler<Collection<HazelcastServerID>>() {
        public void handle(AsyncResult<Collection<HazelcastServerID>> result) {
          DefaultFutureResult<ServerIDs> sresult = new DefaultFutureResult<>();
          if (result.succeeded()) {
            Collection<HazelcastServerID> entries = result.result();
            ServerIDs sids;
            if (entries != null) {
              sids = new ServerIDs(entries.size());
              for (HazelcastServerID hid: entries) {
                sids.add(hid.serverID);
              }
            } else {
              sids = new ServerIDs(0);
            }
            ServerIDs prev = cache.putIfAbsent(subName, sids);
            if (prev != null) {
              // Merge them
              prev.merge(sids);
              sids = prev;
            }
            sids.setInitialised();
            sresult.setResult(sids);
          } else {
View Full Code Here

TOP

Related Classes of org.vertx.java.core.eventbus.impl.ServerIDs

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.