当前位置: 首页>>代码示例>>Java>>正文


Java CoreDescriptor.getInstanceDir方法代码示例

本文整理汇总了Java中org.apache.solr.core.CoreDescriptor.getInstanceDir方法的典型用法代码示例。如果您正苦于以下问题:Java CoreDescriptor.getInstanceDir方法的具体用法?Java CoreDescriptor.getInstanceDir怎么用?Java CoreDescriptor.getInstanceDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.core.CoreDescriptor的用法示例。


在下文中一共展示了CoreDescriptor.getInstanceDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bootstrapConf

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
/**
 * If in SolrCloud mode, upload config sets for each SolrCore in solr.xml.
 */
public static void bootstrapConf(SolrZkClient zkClient, CoreContainer cc, String solrHome) throws IOException,
    KeeperException, InterruptedException {

  //List<String> allCoreNames = cfg.getAllCoreNames();
  List<CoreDescriptor> cds = cc.getCoresLocator().discover(cc);
  
  log.info("bootstrapping config for " + cds.size() + " cores into ZooKeeper using solr.xml from " + solrHome);

  for (CoreDescriptor cd : cds) {
    String coreName = cd.getName();
    String confName = cd.getCollectionName();
    if (StringUtils.isEmpty(confName))
      confName = coreName;
    String instanceDir = cd.getInstanceDir();
    File udir = new File(instanceDir, "conf");
    log.info("Uploading directory " + udir + " with name " + confName + " for SolrCore " + coreName);
    ZkController.uploadConfigDir(zkClient, udir, confName);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:ZkController.java

示例2: createCoreResourceLoader

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
@Override
public SolrResourceLoader createCoreResourceLoader(CoreDescriptor cd) {
  // TODO: Shouldn't the collection node be created by the Collections API?
  zkController.createCollectionZkNode(cd.getCloudDescriptor());
  String configName = zkController.getZkStateReader().readConfigName(cd.getCollectionName());
  return new ZkSolrResourceLoader(cd.getInstanceDir(), configName, parentLoader.getClassLoader(),
      cd.getSubstitutableProperties(), zkController);
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:CloudConfigSetService.java

示例3: checkSharedFSFailoverReplaced

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
/**
 * See if coreNodeName has been taken over by another baseUrl and unload core
 * + throw exception if it has been.
 */
public static void checkSharedFSFailoverReplaced(CoreContainer cc, CoreDescriptor desc) {
  
  ZkController zkController = cc.getZkController();
  String thisCnn = zkController.getCoreNodeName(desc);
  String thisBaseUrl = zkController.getBaseUrl();
  
  log.debug("checkSharedFSFailoverReplaced running for coreNodeName={} baseUrl={}", thisCnn, thisBaseUrl);

  // if we see our core node name on a different base url, unload
  Map<String,Slice> slicesMap = zkController.getClusterState().getSlicesMap(desc.getCloudDescriptor().getCollectionName());
  
  if (slicesMap != null) {
    for (Slice slice : slicesMap.values()) {
      for (Replica replica : slice.getReplicas()) {
        
        String cnn = replica.getName();
        String baseUrl = replica.getStr(ZkStateReader.BASE_URL_PROP);
        log.debug("compare against coreNodeName={} baseUrl={}", cnn, baseUrl);
        
        if (thisCnn != null && thisCnn.equals(cnn)
            && !thisBaseUrl.equals(baseUrl)) {
          if (cc.getCoreNames().contains(desc.getName())) {
            cc.unload(desc.getName());
          }
          
          File instanceDir = new File(desc.getInstanceDir());
          try {
            FileUtils.deleteDirectory(instanceDir);
          } catch (IOException e) {
            SolrException.log(log, "Failed to delete instance dir for core:"
                + desc.getName() + " dir:" + instanceDir.getAbsolutePath());
          }
          log.error("", new SolrException(ErrorCode.SERVER_ERROR,
              "Will not load SolrCore " + desc.getName()
                  + " because it has been replaced due to failover."));
          throw new SolrException(ErrorCode.SERVER_ERROR,
              "Will not load SolrCore " + desc.getName()
                  + " because it has been replaced due to failover.");
        }
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:48,代码来源:CloudUtil.java


注:本文中的org.apache.solr.core.CoreDescriptor.getInstanceDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。