Package org.jredis.cluster

Examples of org.jredis.cluster.ClusterNodeSpec$Support


  /* (non-Javadoc) @see org.jredis.cluster.ClusterModelProviderTestBase#newClusterSpec() */
  @Override
  protected ClusterSpec newClusterSpec () {
    ClusterSpec spec = new DefaultClusterSpec();
    for(int i=0; i<100; i++){
      ClusterNodeSpec node = new DefaultClusterNodeSpec(DefaultConnectionSpec.newSpec("localhost", 6379+i, 0, null));
      spec.addNode(node);
    }
    return spec;
  }
View Full Code Here


      // 3 - Must not support any of the NodeMap modification ops, indicated by raising the specified ProviderException class
      boolean didRaiseEx;     
    ClusterSpec clusterSpec = this.newClusterSpec();
    Set<ClusterNodeSpec> nodeSpecs =  clusterSpec.getNodeSpecs();
    assertTrue(nodeSpecs.size() > 0, "node specs set size must be greater than zero.");
    ClusterNodeSpec aNodeSpec =  (ClusterNodeSpec) nodeSpecs.toArray()[0];
   
      didRaiseEx = false;
      try {
        provider.addNode(aNodeSpec);
      }
View Full Code Here

  /* (non-Javadoc) @see org.jredis.cluster.ClusterModelProviderTestBase#newClusterSpec() */
  @Override
  protected ClusterSpec newClusterSpec () {
    ClusterSpec spec = new DefaultClusterSpec();
    for(int i=0; i<100; i++){
      ClusterNodeSpec node = new DefaultClusterNodeSpec(DefaultConnectionSpec.newSpec("localhost", 6379+i, 0, null));
      spec.addNode(node);
    }
    return spec;
  }
View Full Code Here

      }
    }
  }

  final protected Connection getConnectionForKey(byte[] key){
    ClusterNodeSpec nodeSpec = model.getNodeForKey(key);
    String nodeId = nodeSpec.getId();
   
    // TEMP TEMP TEMP.
    return connections.get(nodeId);
  }
View Full Code Here

      ConnectionSpec connSpec = DefaultConnectionSpec.newSpec()
        .setAddress(templateConnSpec.getAddress())
        .setPort(i)
        .setDatabase(templateConnSpec.getDatabase())
        .setCredentials(templateConnSpec.getCredentials());
      ClusterNodeSpec nodeSpec = new DefaultClusterNodeSpec(connSpec);
      spec.addNode(nodeSpec);
    }
    return spec;
  }
View Full Code Here

  // ------------------------------------------------------------------------
   
  /* (non-Javadoc) @see org.jredis.cluster.ClusterModel#getNodeForKey(byte[]) */
  public ClusterNodeSpec getNodeForKey (byte[] key) {
    long hash = hashAlgo.hash(key);
    final ClusterNodeSpec rv;
    if(!nodeMap.containsKey(hash)) {
      // Java 1.6 adds a ceilingKey method, but I'm still stuck in 1.5
      // in a lot of places, so I'm doing this myself.
      SortedMap<Long, ClusterNodeSpec> tailMap=nodeMap.tailMap(hash);
      if(tailMap.isEmpty()) {
View Full Code Here

TOP

Related Classes of org.jredis.cluster.ClusterNodeSpec$Support

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.