code: private void selectGroup(final Object key, final Handler<AsyncResult<String>> doneHandler) {
      context.execute(new Action<String>() {
        @Override
        public String perform() {
          String address = groupSelectors.get(key);
          if (address != null) {
            return address;
          }
          Set<String> groups = DefaultClusterManager.this.groups.keySet();
          int index = new Random().nextInt(groups.size());
          int i = 0;
          for (String group : groups) {
            if (i == index) {
              groupSelectors.put(key, group);
              return group;
            }
            i++;
          }
          return null;
        }
      }, doneHandler);
    }
docs: Selects a group in the cluster.