gpt4 book ai didi

org.apache.solr.common.cloud.ZooKeeperException.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 17:45:31 31 4
gpt4 key购买 nike

本文整理了Java中org.apache.solr.common.cloud.ZooKeeperException.<init>()方法的一些代码示例,展示了ZooKeeperException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperException.<init>()方法的具体详情如下:
包路径:org.apache.solr.common.cloud.ZooKeeperException
类名称:ZooKeeperException
方法名:<init>

ZooKeeperException.<init>介绍

暂无

代码示例

代码示例来源:origin: NGDATA/hbase-indexer

@Override
public String getConfigDir() {
 throw new ZooKeeperException(
   ErrorCode.SERVER_ERROR,
   "ZkSolrResourceLoader does not support getConfigDir() - likely, what you are trying to do is not supported in ZooKeeper mode");
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

@Override
public String getConfigDir() {
 throw new ZooKeeperException(
   ErrorCode.SERVER_ERROR,
   "ZkSolrResourceLoader does not support getConfigDir() - likely, what you are trying to do is not supported in ZooKeeper mode");
}

代码示例来源:origin: org.apache.solr/solr-solrj

@Override
 public void command() {
  try {
   ZkStateReader.this.createClusterStateWatchersAndUpdate();
  } catch (KeeperException e) {
   log.error("A ZK error has occurred", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.error("Interrupted", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "Interrupted", e);
  }
 }
});

代码示例来源:origin: org.apache.solr/solr-solrj

private void closeKeeper(SolrZooKeeper keeper) {
  try {
   keeper.close();
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.error("", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
     "", e);
  }
 }
}

代码示例来源:origin: NGDATA/hbase-indexer

@Override
  public String[] listConfigDir() {
   List<String> list;
   try {
    list = zk.getChildren(configZkPath, false, null);
   } catch (InterruptedException e) {
    // Restore the interrupted status
    Thread.currentThread().interrupt();
    log.error("", e);
    throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
      "", e);
   } catch (KeeperException e) {
    log.error("", e);
    throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
      "", e);
   }
   return list.toArray(new String[0]);
  }
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

@Override
  public String[] listConfigDir() {
   List<String> list;
   try {
    list = zk.getChildren(configZkPath, false, null);
   } catch (InterruptedException e) {
    // Restore the interrupted status
    Thread.currentThread().interrupt();
    log.error("", e);
    throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
      "", e);
   } catch (KeeperException e) {
    log.error("", e);
    throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
      "", e);
   }
   return list.toArray(new String[0]);
  }
}

代码示例来源:origin: org.apache.solr/solr-solrj

private void closeKeeper(SolrZooKeeper keeper) {
 if (keeper != null) {
  try {
   keeper.close();
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.error("", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "",
     e);
  }
 }
}

代码示例来源:origin: com.hynnet/solr-solrj

private void closeKeeper(SolrZooKeeper keeper) {
  try {
   keeper.close();
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.error("", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
     "", e);
  }
 }
}

代码示例来源:origin: com.hynnet/solr-solrj

@Override
 public void command() {
  try {
   ZkStateReader.this.createClusterStateWatchersAndUpdate();
  } catch (KeeperException e) {
   log.error("", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
     "", e);
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.error("", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
     "", e);
  }
 }
});

代码示例来源:origin: com.hynnet/solr-solrj

private void closeKeeper(SolrZooKeeper keeper) {
 if (keeper != null) {
  try {
   keeper.close();
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.error("", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "",
     e);
  }
 }
}

代码示例来源:origin: org.apache.solr/solr-solrj

public void refreshAndWatch() {
  try {
   refreshLiveNodes(this);
  } catch (KeeperException.SessionExpiredException | KeeperException.ConnectionLossException e) {
   log.warn("ZooKeeper watch triggered, but Solr cannot talk to ZK: [{}]", e.getMessage());
  } catch (KeeperException e) {
   log.error("A ZK error has occurred", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.warn("Interrupted", e);
  }
 }
}

代码示例来源:origin: org.apache.solr/solr-solrj

/** Must hold {@link #getUpdateLock()} before calling this method. */
 public void refreshAndWatch() {
  try {
   refreshCollectionList(this);
  } catch (KeeperException.SessionExpiredException | KeeperException.ConnectionLossException e) {
   log.warn("ZooKeeper watch triggered, but Solr cannot talk to ZK: [{}]", e.getMessage());
  } catch (KeeperException e) {
   log.error("A ZK error has occurred", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.warn("Interrupted", e);
  }
 }
}

代码示例来源:origin: org.apache.solr/solr-solrj

} catch (KeeperException e) {
 log.error("Lost collection property watcher for {} due to ZK error", coll, e);
 throw new ZooKeeperException(ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
} catch (InterruptedException e) {
 Thread.currentThread().interrupt();

代码示例来源:origin: org.apache.solr/solr-solrj

/**
  * Refresh collection state from ZK and leave a watch for future changes.
  * As a side effect, updates {@link #clusterState} and {@link #watchedCollectionStates}
  * with the results of the refresh.
  */
 public void refreshAndWatch() {
  try {
   DocCollection newState = fetchCollectionState(coll, this);
   updateWatchedCollection(coll, newState);
   synchronized (getUpdateLock()) {
    constructState(Collections.singleton(coll));
   }
  } catch (KeeperException.SessionExpiredException | KeeperException.ConnectionLossException e) {
   log.warn("ZooKeeper watch triggered, but Solr cannot talk to ZK: [{}]", e.getMessage());
  } catch (KeeperException e) {
   log.error("Unwatched collection: [{}]", coll, e);
   throw new ZooKeeperException(ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
  } catch (InterruptedException e) {
   Thread.currentThread().interrupt();
   log.error("Unwatched collection: [{}]", coll, e);
  }
 }
}

代码示例来源:origin: org.apache.solr/solr-solrj

/** Must hold {@link #getUpdateLock()} before calling this method. */
 public void refreshAndWatch() {
  try {
   refreshLegacyClusterState(this);
  } catch (KeeperException.NoNodeException e) {
   throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
       "Cannot connect to cluster at " + zkClient.getZkServerAddress() + ": cluster not found/not ready");
  } catch (KeeperException.SessionExpiredException | KeeperException.ConnectionLossException e) {
   log.warn("ZooKeeper watch triggered, but Solr cannot talk to ZK: [{}]", e.getMessage());
  } catch (KeeperException e) {
   log.error("A ZK error has occurred", e);
   throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
  } catch (InterruptedException e) {
   // Restore the interrupted status
   Thread.currentThread().interrupt();
   log.warn("Interrupted", e);
  }
 }
}

代码示例来源:origin: org.apache.solr/solr-solrj

@Override
public void connect() {
 if (zkStateReader == null) {
  synchronized (this) {
   if (zkStateReader == null) {
    ZkStateReader zk = null;
    try {
     zk = new ZkStateReader(zkHost, zkClientTimeout, zkConnectTimeout);
     zk.createClusterStateWatchersAndUpdate();
     zkStateReader = zk;
     log.info("Cluster at {} ready", zkHost);
    } catch (InterruptedException e) {
     zk.close();
     Thread.currentThread().interrupt();
     throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e);
    } catch (KeeperException e) {
     zk.close();
     throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e);
    } catch (Exception e) {
     if (zk != null) zk.close();
     // do not wrap because clients may be relying on the underlying exception being thrown
     throw e;
    }
   }
  }
 }
}

代码示例来源:origin: org.apache.solr/solr-solrj

@Override
public void process(WatchedEvent event) {
 // session events are not change events, and do not remove the watcher
 if (EventType.None.equals(event.getType())) {
  return;
 }
 try {
  log.debug("Aliases: updating");
  // re-register the watch
  Stat stat = new Stat();
  final byte[] data = zkClient.getData(ALIASES, this, stat, true);
  // note: it'd be nice to avoid possibly needlessly parsing if we don't update aliases but not a big deal
  setIfNewer(Aliases.fromJSON(data, stat.getVersion()));
 } catch (KeeperException.ConnectionLossException | KeeperException.SessionExpiredException e) {
  // note: aliases.json is required to be present
  log.warn("ZooKeeper watch triggered, but Solr cannot talk to ZK: [{}]", e.getMessage());
 } catch (KeeperException e) {
  log.error("A ZK error has occurred", e);
  throw new ZooKeeperException(ErrorCode.SERVER_ERROR, "A ZK error has occurred", e);
 } catch (InterruptedException e) {
  // Restore the interrupted status
  Thread.currentThread().interrupt();
  log.warn("Interrupted", e);
 }
}

代码示例来源:origin: org.apache.solr/solr-solrj

@Override
public void process(WatchedEvent event) {
 // session events are not change events, and do not remove the watcher
 if (EventType.None.equals(event.getType())) {
  return;
 }
 try {
  synchronized (ZkStateReader.this.getUpdateLock()) {
   log.debug("Updating [{}] ... ", SOLR_SECURITY_CONF_PATH);
   // remake watch
   final Watcher thisWatch = this;
   final Stat stat = new Stat();
   final byte[] data = getZkClient().getData(SOLR_SECURITY_CONF_PATH, thisWatch, stat, true);
   try {
    callback.call(new Pair<>(data, stat));
   } catch (Exception e) {
    log.error("Error running collections node listener", e);
   }
  }
 } catch (KeeperException.ConnectionLossException | KeeperException.SessionExpiredException e) {
  log.warn("ZooKeeper watch triggered, but Solr cannot talk to ZK: [{}]", e.getMessage());
 } catch (KeeperException e) {
  log.error("A ZK error has occurred", e);
  throw new ZooKeeperException(ErrorCode.SERVER_ERROR, "", e);
 } catch (InterruptedException e) {
  // Restore the interrupted status
  Thread.currentThread().interrupt();
  log.warn("Interrupted", e);
 }
}

代码示例来源:origin: com.hynnet/solr-solrj

/**
 * Connect to the zookeeper ensemble.
 * This is an optional method that may be used to force a connect before any other requests are sent.
 *
 */
public void connect() {
 if (zkStateReader == null) {
  synchronized (this) {
   if (zkStateReader == null) {
    ZkStateReader zk = null;
    try {
     zk = new ZkStateReader(zkHost, zkClientTimeout, zkConnectTimeout);
     zk.createClusterStateWatchersAndUpdate();
     zkStateReader = zk;
    } catch (InterruptedException e) {
     zk.close();
     Thread.currentThread().interrupt();
     throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e);
    } catch (KeeperException e) {
     zk.close();
     throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "", e);
    } catch (Exception e) {
     if (zk != null) zk.close();
     // do not wrap because clients may be relying on the underlying exception being thrown
     throw e;
    }
   }
  }
 }
}

代码示例来源:origin: org.apache.solr/solr-solrj

if (!zkClient.exists(configPath, true)) {
 log.error("Specified config=[{}] does not exist in ZooKeeper at location=[{}]", configName, configPath);
 throw new ZooKeeperException(ErrorCode.SERVER_ERROR, "Specified config does not exist in ZooKeeper: " + configName);
} else {
 log.debug("path=[{}] [{}]=[{}] specified config exists in ZooKeeper", configPath, CONFIGNAME_PROP, configName);
throw new ZooKeeperException(ErrorCode.INVALID_STATE, "No config data found at path: " + path);

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com