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


Java CoreDescriptor.getName方法代码示例

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


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

示例1: EmbeddedSolrServer

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
/**
 * Use the other constructor using a CoreContainer and a name.
 * @deprecated use {@link #EmbeddedSolrServer(CoreContainer, String)} instead.
 */
@Deprecated
public EmbeddedSolrServer( SolrCore core )
{
  if ( core == null ) {
    throw new NullPointerException("SolrCore instance required");
  }
  CoreDescriptor dcore = core.getCoreDescriptor();
  if (dcore == null)
    throw new NullPointerException("CoreDescriptor required");
  
  CoreContainer cores = dcore.getCoreContainer();
  if (cores == null)
    throw new NullPointerException("CoreContainer required");
  
  coreName = dcore.getName();
  coreContainer = cores;
  _parser = new SolrRequestParsers( null );
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:EmbeddedSolrServer.java

示例2: waitForShardId

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
private void waitForShardId(CoreDescriptor cd) {
  log.info("waiting to find shard id in clusterstate for " + cd.getName());
  int retryCount = 320;
  while (retryCount-- > 0) {
    final String shardId = zkStateReader.getClusterState().getShardId(getNodeName(), cd.getName());
    if (shardId != null) {
      cd.getCloudDescriptor().setShardId(shardId);
      return;
    }
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
  
  throw new SolrException(ErrorCode.SERVER_ERROR,
      "Could not get shard id for core: " + cd.getName());
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:ZkController.java

示例3: 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

示例4: waitForCoreNodeName

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
private void waitForCoreNodeName(CoreDescriptor descriptor) {
  int retryCount = 320;
  log.info("look for our core node name");
  while (retryCount-- > 0) {
    Map<String,Slice> slicesMap = zkStateReader.getClusterState()
        .getSlicesMap(descriptor.getCloudDescriptor().getCollectionName());
    if (slicesMap != null) {
      
      for (Slice slice : slicesMap.values()) {
        for (Replica replica : slice.getReplicas()) {
          // TODO: for really large clusters, we could 'index' on this
          
          String nodeName = replica.getStr(ZkStateReader.NODE_NAME_PROP);
          String core = replica.getStr(ZkStateReader.CORE_NAME_PROP);
          
          String msgNodeName = getNodeName();
          String msgCore = descriptor.getName();

          if (msgNodeName.equals(nodeName) && core.equals(msgCore)) {
            descriptor.getCloudDescriptor()
                .setCoreNodeName(replica.getName());
            return;
          }
        }
      }
    }
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:ZkController.java

示例5: getCoreNodeName

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
public String getCoreNodeName(CoreDescriptor descriptor){
  String coreNodeName = descriptor.getCloudDescriptor().getCoreNodeName();
  if (coreNodeName == null && !genericCoreNodeNames) {
    // it's the default
    return getNodeName() + "_" + descriptor.getName();
  }
  
  return coreNodeName;
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:ZkController.java

示例6: RecoveryStrategy

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
public RecoveryStrategy(CoreContainer cc, CoreDescriptor cd, RecoveryListener recoveryListener) {
  this.cc = cc;
  this.coreName = cd.getName();
  this.recoveryListener = recoveryListener;
  setName("RecoveryThread");
  zkController = cc.getZkController();
  zkStateReader = zkController.getZkStateReader();
  baseUrl = zkController.getBaseUrl();
  coreZkNodeName = cd.getCloudDescriptor().getCoreNodeName();
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:RecoveryStrategy.java

示例7: publish

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
/**
 * Publish core state to overseer.
 */
public void publish(final CoreDescriptor cd, final String state, boolean updateLastState) throws KeeperException, InterruptedException {
  log.info("publishing core={} state={}", cd.getName(), state);
  //System.out.println(Thread.currentThread().getStackTrace()[3]);
  Integer numShards = cd.getCloudDescriptor().getNumShards();
  if (numShards == null) { //XXX sys prop hack
    log.info("numShards not found on descriptor - reading it from system property");
    numShards = Integer.getInteger(ZkStateReader.NUM_SHARDS_PROP);
  }
  
  String coreNodeName = cd.getCloudDescriptor().getCoreNodeName();
  //assert cd.getCloudDescriptor().getShardId() != null;
  ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, "state", 
      ZkStateReader.STATE_PROP, state, 
      ZkStateReader.BASE_URL_PROP, getBaseUrl(), 
      ZkStateReader.CORE_NAME_PROP, cd.getName(),
      ZkStateReader.ROLES_PROP, cd.getCloudDescriptor().getRoles(),
      ZkStateReader.NODE_NAME_PROP, getNodeName(),
      ZkStateReader.SHARD_ID_PROP, cd.getCloudDescriptor().getShardId(),
      ZkStateReader.COLLECTION_PROP, cd.getCloudDescriptor()
          .getCollectionName(),
      ZkStateReader.NUM_SHARDS_PROP, numShards != null ? numShards.toString()
          : null,
      ZkStateReader.CORE_NODE_NAME_PROP, coreNodeName != null ? coreNodeName
          : null);
  if (updateLastState) {
    cd.getCloudDescriptor().lastPublished = state;
  }
  overseerJobQueue.offer(ZkStateReader.toJSON(m));
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:33,代码来源:ZkController.java

示例8: getCoreNodeName

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
public String getCoreNodeName(CoreDescriptor descriptor){
  String coreNodeName = descriptor.getCloudDescriptor().getCoreNodeName();
  if (coreNodeName == null) {
    // it's the default
    return getNodeName() + "_" + descriptor.getName();
  }
  
  return coreNodeName;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:10,代码来源:ZkController.java

示例9: RecoveryStrategy

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
public RecoveryStrategy(CoreContainer cc, CoreDescriptor cd, RecoveryListener recoveryListener) {
  this.cc = cc;
  this.coreName = cd.getName();
  this.recoveryListener = recoveryListener;
  setName("RecoveryThread");
  zkController = cc.getZkController();
  zkStateReader = zkController.getZkStateReader();
  baseUrl = zkController.getBaseUrl();
  coreZkNodeName = zkController.getCoreNodeName(cd);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:11,代码来源:RecoveryStrategy.java

示例10: waitForCoreNodeName

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
private void waitForCoreNodeName(CoreDescriptor descriptor) {
  int retryCount = 320;
  log.info("look for our core node name");
  while (retryCount-- > 0) {
    Map<String,Slice> slicesMap = zkStateReader.getClusterState()
        .getSlicesMap(descriptor.getCloudDescriptor().getCollectionName());
    if (slicesMap != null) {
      
      for (Slice slice : slicesMap.values()) {
        for (Replica replica : slice.getReplicas()) {
          // TODO: for really large clusters, we could 'index' on this
          
          String nodeName = replica.getStr(ZkStateReader.NODE_NAME_PROP);
          String core = replica.getStr(ZkStateReader.CORE_NAME_PROP);
          
          String msgNodeName = getNodeName();
          String msgCore = descriptor.getName();

          if (nodeName.equals(msgNodeName) && core.equals(msgCore)) {
            descriptor.getCloudDescriptor()
                .setCoreNodeName(replica.getName());
            return;
          }
        }
      }
    }
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:34,代码来源:ZkController.java

示例11: 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.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。