Package net.spy.memcached.config

Examples of net.spy.memcached.config.ClusterConfiguration


        isConfigurationProtocolSupported = false;
      }
     
      if(configResult != null && ! configResult.trim().isEmpty()){
        //Parse configuration to get the list of cache servers.
        ClusterConfiguration clusterConfiguration = AddrUtil.parseClusterTypeConfiguration(configResult);
       
        //Initialize client with the actual set of endpoints.
        mconn.notifyUpdate(clusterConfiguration);
        isConfigurationInitialized = true;
      }
View Full Code Here


      NodeEndPoint endPoint = new NodeEndPoint(hostName, ipAddress, port);
      endPoints.add(endPoint);
    }
    assert !endPoints.isEmpty() : "No endpoints found";
   
    ClusterConfiguration config = new ClusterConfiguration(versionNumber, endPoints);
   
    return config;
  }
View Full Code Here

  public ConfigurationPoller(final MemcachedClient client, long pollingInterval){
    this.client = client;
   
    //The explicit typed emptyList assignment avoids type warning.
    List<NodeEndPoint> emptyList = Collections.emptyList();
    this.currentClusterConfiguration = new ClusterConfiguration(-1, emptyList);
   
    //Keep the initial delay to few seconds to begin polling quickly. This is useful if the config API call timed out in Client constructor
    //and did not initialize the set of nodes in the cluster. The poller takes over the responsibility of configuring the client with the
    //nodes in the cluster. 
    scheduledExecutor.scheduleAtFixedRate(this, INITIAL_DELAY, pollingInterval, TimeUnit.MILLISECONDS);
View Full Code Here

      }
     
      getLogger().debug("Retrieved configuration value:" + newConfigResponse);
     
      if(newConfigResponse != null && !newConfigResponse.equals(currentClusterConfigResponse)){
        ClusterConfiguration newClusterConfiguration = AddrUtil.parseClusterTypeConfiguration(newConfigResponse);
        getLogger().warn("Change in configuration - Existing configuration: " + currentClusterConfiguration + "\n New configuration:" +  newClusterConfiguration);
        if(newClusterConfiguration.getConfigVersion() > currentClusterConfiguration.getConfigVersion()){
          currentClusterConfigResponse = newConfigResponse;
          currentClusterConfiguration = newClusterConfiguration;
          for(ClusterConfigurationObserver observer : clusterConfigObservers){
            getLogger().info("Notifying observers about configuration change.");
            observer.notifyUpdate(newClusterConfiguration);
          }
          if(!client.isConfigurationInitialized()){
            client.setIsConfigurtionInitialized(true);
          }
        } else if(newClusterConfiguration.getConfigVersion() < currentClusterConfiguration.getConfigVersion()){
          getLogger().info("Ignoring stale configuration - Existing configuration: " + currentClusterConfigResponse + "\n Stale configuration:" +  newConfigResponse);
          trackPollingError();
          return;
        }
      }
View Full Code Here

TOP

Related Classes of net.spy.memcached.config.ClusterConfiguration

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.