server/src/main/java/com/orientechnologies/orient/server/distributed/ODistributedConfiguration.java
public List<String> getOwnedClustersByServer(Collection<String> iClusterNames, final String iNode) {
    if (iClusterNames == null || iClusterNames.isEmpty())
      iClusterNames = DEFAULT_CLUSTER_NAME;

    final List<String> notDefinedClusters = new ArrayList<String>(5);
    final List<String> candidates = new ArrayList<String>(5);

    for (String p : iClusterNames) {
      if (p == null)
        continue;

      final String ownerServer = getClusterOwner(p);
      if (ownerServer == null)
        notDefinedClusters.add(p);
      else if (iNode.equals(ownerServer)) {
        // COLLECT AS CANDIDATE
        candidates.add(p);
      }
    }

    if (!candidates.isEmpty())
      // RETURN THE FIRST ONE
      return candidates;

    final String owner = getClusterOwner(ALL_WILDCARD);
    if (iNode.equals(owner))
      // CURRENT SERVER IS MASTER OF DEFAULT: RETURN ALL THE NON CONFIGURED CLUSTERS
      return notDefinedClusters;

    // NO MASTER FOUND, RETURN EMPTY LIST
    return candidates;
  }
public List<String> getOwnedClustersByServer(Collection<String> iClusterNames, final String iNode) {
    if (iClusterNames == null || iClusterNames.isEmpty())
      iClusterNames = DEFAULT_CLUSTER_NAME;

    final List<String> notDefinedClusters = new ArrayList<String>(5);
    final List<String> candidates = new ArrayList<String>(5);

    for (String p : iClusterNames) {
      if (p == null)
        continue;

      final String ownerServer = getClusterOwner(p);
      if (ownerServer == null)
        notDefinedClusters.add(p);
      else if (iNode.equals(ownerServer)) {
        // COLLECT AS CANDIDATE
        candidates.add(p);
      }
    }

    if (!candidates.isEmpty())
      // RETURN THE FIRST ONE
      return candidates;

    final String owner = getClusterOwner(ALL_WILDCARD);
    if (iNode.equals(owner))
      // CURRENT SERVER IS MASTER OF DEFAULT: RETURN ALL THE NON CONFIGURED CLUSTERS
      return notDefinedClusters;

    // NO MASTER FOUND, RETURN EMPTY LIST
    return candidates;
  }
public List < String > getOwnedClustersByServer ( Collection < String > iClusterNames , final String iNode ) { if ( iClusterNames == null || iClusterNames . isEmpty ( ) ) iClusterNames = DEFAULT_CLUSTER_NAME ; final List < String > notDefinedClusters = new ArrayList < String > ( 5 ) ; final List < String > candidates = new ArrayList < String > ( 5 ) ; for ( String p : iClusterNames ) { if ( p == null ) continue ; final String ownerServer = getClusterOwner ( p ) ; if ( ownerServer == null ) notDefinedClusters . add ( p ) ; else if ( iNode . equals ( ownerServer ) ) { // COLLECT AS CANDIDATE candidates . add ( p ) ; } } if ( ! candidates . isEmpty ( ) ) // RETURN THE FIRST ONE return candidates ; final String owner = getClusterOwner ( ALL_WILDCARD ) ; if ( iNode . equals ( owner ) ) // CURRENT SERVER IS MASTER OF DEFAULT: RETURN ALL THE NON CONFIGURED CLUSTERS return notDefinedClusters ; // NO MASTER FOUND, RETURN EMPTY LIST return candidates ; }
Returns the clusters where a server is owner. This is used when a cluster must be selected: locality is always the best choice.

@param iClusterNames Set of cluster names
@param iNode         Node
Returns the clusters where a server is owner . This is used when a cluster must be selected : locality is always the best choice .