Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.clustermate.client;


Container class for an ordered set of references to server nodes that should be contacted for accessing content for given key, based on key hash based matching.
 
 public class NodesForKey
    private final static ClusterServerNode[] NO_NODES = new ClusterServerNode[0];
    
    private final int _version;
    private final ClusterServerNode[] _nodes;
    
    /*
    /**********************************************************************
    /* Construction
    /**********************************************************************
     */
    
    public NodesForKey(int versionClusterServerNode[] nodes)
    {
         = version;
         = nodes;
    }
    public static NodesForKey empty(int version) {
        return new NodesForKey(version);
    }
    
    /*
    /**********************************************************************
    /* Accessors
    /**********************************************************************
     */
    
    public int version() { return ; }
    public int size() { return .; }
    
    public ClusterServerNode node(int index) {
        return [index];
    }
    /*
    /**********************************************************************
    /* Overrides
    /**********************************************************************
     */
    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        sb.append("[Nodes (").append(.).append(") ");
        for (int i = 0, end = .i < end; ++i) {
            if (i > 0) {
                sb.append(", ");
            }
            ClusterServerNode node = [i];
            sb.append(node.getAddress()).append(": ranges=");
            sb.append(node.getActiveRange()).append('/').append(node.getPassiveRange());
        }
        sb.append(")");
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X