Package me.prettyprint.cassandra.service

Examples of me.prettyprint.cassandra.service.ThriftCluster


      return c;
    }
  }

  public static Cluster createCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) {   
    return clusters.get(clusterName) == null ? new ThriftCluster(clusterName, cassandraHostConfigurator) : clusters.get(clusterName);
  }
View Full Code Here


  public static Cluster createCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) {   
    return clusters.get(clusterName) == null ? new ThriftCluster(clusterName, cassandraHostConfigurator) : clusters.get(clusterName);
  }

  public static Cluster createCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator, Map<String, String> credentials) {
    return clusters.get(clusterName) == null ? new ThriftCluster(clusterName, cassandraHostConfigurator, credentials) : clusters.get(clusterName);   
  }
View Full Code Here

     * @throws CassandraServerManagementException
     *          for errors during getting the token ring
     */
    public TokenRangeInformation[] getTokenRange(String keyspace) throws CassandraServerManagementException {
        validateKeyspace(keyspace);
        ThriftCluster thriftCluster = (ThriftCluster) getCluster(null);     // TODO  hector limitation
        Set<CassandraHost> cassandraHosts = thriftCluster.getKnownPoolHosts(true)// This returns all endpoints if only auto discovery is set.
        int rpcPort = CassandraHost.DEFAULT_PORT;
        for (CassandraHost cassandraHost : cassandraHosts) {
            if (cassandraHost != null) {
                rpcPort = cassandraHost.getPort()// With hector, each node has the same RPC port.
                break;
            }
        }

        List<TokenRangeInformation> tokenRangeInformations = new ArrayList<TokenRangeInformation>();

        if (!KEYSPACE_SYSTEM.equals(keyspace)) {
            List<TokenRange> tokenRanges = thriftCluster.describeRing(keyspace);
            for (TokenRange tokenRange : tokenRanges) {
                if (tokenRange != null) {
                    TokenRangeInformation tokenRangeInformation = new TokenRangeInformation();
                    tokenRangeInformation.setStartToken(tokenRange.getStart_token());
                    tokenRangeInformation.setEndToken(tokenRange.getEnd_token());
View Full Code Here

    public void setActive(boolean active) {
        this.active = active;
    }
   
    public Cluster createCluster() {
        return new ThriftCluster(clusterName, new CassandraHostConfigurator(hosts));
    }
View Full Code Here

        if (env.acceptsProfiles(Constants.SPRING_PROFILE_METRICS)) {
            log.debug("Cassandra Metrics monitoring enabled");
            HOpTimer hOpTimer = new MetricsOpTimer(cassandraClusterName);
            cassandraHostConfigurator.setOpTimer(hOpTimer);
        }
        ThriftCluster cluster = new ThriftCluster(cassandraClusterName, cassandraHostConfigurator);
        this.myCluster = cluster; // Keep a pointer to the cluster, as Hector is buggy and can't find it again...
        ConfigurableConsistencyLevel consistencyLevelPolicy = new ConfigurableConsistencyLevel();
        consistencyLevelPolicy.setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);

        KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(cassandraKeyspace);
        if (keyspaceDef == null) {
            log.warn("Keyspace \" {} \" does not exist, creating it!", cassandraKeyspace);
            keyspaceDef = new ThriftKsDef(cassandraKeyspace);
            cluster.addKeyspace(keyspaceDef, true);

            addColumnFamily(cluster, USER_CF, 0);
            addColumnFamily(cluster, FRIENDS_CF, 0);
            addColumnFamily(cluster, FOLLOWERS_CF, 0);
            addColumnFamily(cluster, STATUS_CF, 0);
View Full Code Here

    try {
     
      String clusterName = connectionManager.getClusterName();
     
      //this could be suspect, but we need this
      ThriftCluster cluster = (ThriftCluster) HFactory.getCluster(clusterName);

      for(KeyspaceDefinition keyspaceDefinition: cluster.describeKeyspaces()) {       
        if (!keyspaceDefinition.getName().equals(Keyspace.KEYSPACE_SYSTEM)) {
          List<TokenRange> tokenRanges = cluster.describeRing(keyspaceDefinition.getName());
          for (TokenRange tokenRange : tokenRanges) {
            for (String host : tokenRange.getEndpoints()) {
              CassandraHost foundHost = new CassandraHost(host,cassandraHostConfigurator.getPort());
              if ( !existingHosts.contains(foundHost) ) {
                log.info("Found a node we don't know about {} for TokenRange {}", foundHost, tokenRange);
View Full Code Here

   *
   */
  public static Cluster createCluster(String clusterName,
      CassandraHostConfigurator cassandraHostConfigurator) {
    synchronized (clusters) {
      return clusters.get(clusterName) == null ? new ThriftCluster(clusterName,
          cassandraHostConfigurator) : clusters.get(clusterName);
    }
  }
View Full Code Here

   */
  public static Cluster createCluster(String clusterName,
      CassandraHostConfigurator cassandraHostConfigurator,
      Map<String, String> credentials) {
    synchronized (clusters) {
      return clusters.get(clusterName) == null ? new ThriftCluster(clusterName,
          cassandraHostConfigurator, credentials) : clusters.get(clusterName);
    }
  }
View Full Code Here

TOP

Related Classes of me.prettyprint.cassandra.service.ThriftCluster

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.