Package com.couchbase.client.vbucket.config

Examples of com.couchbase.client.vbucket.config.Bucket


            bootstrap();
            return;
          }
          String appliedConfig = binaryConnection.get().replaceConfigWildcards(
            configs.get(0));
          Bucket config = configurationParser.parseBucket(appliedConfig);
          setConfig(config);
        } catch(Exception ex) {
          getLogger().info("Could not load config from existing "
            + "connection, rerunning bootstrap.", ex);
          bootstrap();
View Full Code Here


   */
  public Bucket getBucketConfiguration(final String bucketname) {
    if (bucketname == null || bucketname.isEmpty()) {
      throw new IllegalArgumentException("Bucket name can not be blank.");
    }
    Bucket bucket = this.buckets.get(bucketname);
    if (bucket == null) {
      boolean warmedUp = false;
      int maxBackoffRetries = 5;
      int retryCount = 1;
      while(!warmedUp) {
View Full Code Here

    throw new ConfigurationException("Configuration for bucket \""
      + bucketToFind + "\" was not found in server list (" + baseList + ").");
  }

  public List<InetSocketAddress> getServerList(final String bucketname) {
    Bucket bucket = getBucketConfiguration(bucketname);
    List<String> servers = bucket.getConfig().getServers();
    StringBuilder serversString = new StringBuilder();
    for (String server : servers) {
      serversString.append(server).append(' ');
    }
    return AddrUtil.getAddresses(serversString.toString());
View Full Code Here

    reSubBucket = bucketName;  // More than one subscriber, would be an error
    reSubRec = rec;

    getLogger().debug("Subscribing an object for reconfiguration updates "
      + rec.getClass().getName());
    Bucket bucket = getBucketConfiguration(bucketName);

    if(bucket == null) {
      throw new ConfigurationException("Could not get bucket configuration "
        + "for: " + bucketName);
    }

    ReconfigurableObserver obs = new ReconfigurableObserver(rec);
    BucketMonitor monitor = this.monitors.get(bucketName);
    if (monitor == null) {
      URI streamingURI = bucket.getStreamingURI();
      monitor = new BucketMonitor(this.loadedBaseUri.resolve(streamingURI),
        this.restUsr, this.restPwd, configurationParser, this);
      this.monitors.put(bucketName, monitor);
      monitor.addObserver(obs);
      monitor.startMonitor();
View Full Code Here

      monitor.deleteObserver(new ReconfigurableObserver(rec));
    }
  }

  public Config getLatestConfig(String bucketname) {
    Bucket bucket = getBucketConfiguration(bucketname);
    return bucket.getConfig();
  }
View Full Code Here

    }

    String appliedConfig = connection.replaceConfigWildcards(
      configs.get(0));
    try {
        Bucket config = configurationParser.parseBucket(appliedConfig);
        setConfig(config);
    } catch(Exception ex) {
        getLogger().warn("Could not parse config, retrying bootstrap.", ex);
        connection.shutdown();
        return false;
View Full Code Here

      return false;
    }

    try {
      httpProvider.get().clearBuckets();
      Bucket config = httpProvider.get().getBucketConfiguration(bucket);
      setConfig(config);
      monitorBucket();
      isBinary = false;
      return true;
    } catch(Exception ex) {
View Full Code Here

            bootstrap();
            return;
          }
          String appliedConfig = binaryConnection.get().replaceConfigWildcards(
            configs.get(0));
          Bucket config = configurationParser.parseBucket(appliedConfig);
          setConfig(config);
        } catch(Exception ex) {
          getLogger().info("Could not load config from existing "
            + "connection, rerunning bootstrap.", ex);
          bootstrap();
View Full Code Here

  /**
   * Take any action required when the monitor appears to be disconnected.
   */
  protected void notifyDisconnected() {
    Bucket bucket = provider.getBucketConfiguration(provider.getBucket());
    bucket.setIsNotUpdating();
    LOGGER.trace("Marked bucket " + bucket.getName()
      + " as not updating.  Notifying observers.");
    LOGGER.trace("There appear to be " + this.countObservers()
      + " observers waiting for notification");
    setChanged();
    notifyObservers();
View Full Code Here

    channel.write(request);
    try {
      String response = this.handler.getLastResponse();
      LOGGER.debug("Getting server list returns this last chunked response:\n"
          + response);
      Bucket bucketToMonitor = this.configParser.parseBucket(response);
      setChanged();
      notifyObservers(bucketToMonitor);
    } catch (ParseException ex) {
      LOGGER.warn("Invalid client configuration received from server. "
        + "Staying with existing configuration.", ex);
View Full Code Here

TOP

Related Classes of com.couchbase.client.vbucket.config.Bucket

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.