コード例 #1
0
  /** {@inheritDoc} */
  @Override
  public void onDiscoveryDataReceived(UUID nodeId, UUID rmtNodeId, Serializable data) {
    Map<String, Serializable> discData = (Map<String, Serializable>) data;

    if (discData != null) {
      for (Map.Entry<String, Serializable> e : discData.entrySet()) {
        PluginProvider provider = plugins.get(e.getKey());

        if (provider != null) provider.receiveDiscoveryData(nodeId, e.getValue());
        else U.warn(log, "Received discovery data for unknown plugin: " + e.getKey());
      }
    }
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Nullable
  @Override
  public Serializable collectDiscoveryData(UUID nodeId) {
    HashMap<String, Serializable> discData = null;

    for (Map.Entry<String, PluginProvider> e : plugins.entrySet()) {
      Serializable data = e.getValue().provideDiscoveryData(nodeId);

      if (data != null) {
        if (discData == null) discData = new HashMap<>();

        discData.put(e.getKey(), data);
      }
    }

    return discData;
  }