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


Java CoreDescriptor.getConfigName方法代码示例

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


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

示例1: getCoreStatus

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
/**
 * Returns the core status for a particular core.
 * @param cores - the enclosing core container
 * @param cname - the core to return
 * @param isIndexInfoNeeded - add what may be expensive index information. NOT returned if the core is not loaded
 * @return - a named list of key/value pairs from the core.
 * @throws IOException - LukeRequestHandler can throw an I/O exception
 */
protected NamedList<Object> getCoreStatus(CoreContainer cores, String cname, boolean isIndexInfoNeeded)  throws IOException {
  NamedList<Object> info = new SimpleOrderedMap<>();

  if (!cores.isLoaded(cname)) { // Lazily-loaded core, fill in what we can.
    // It would be a real mistake to load the cores just to get the status
    CoreDescriptor desc = cores.getUnloadedCoreDescriptor(cname);
    if (desc != null) {
      info.add("name", desc.getName());
      info.add("isDefaultCore", desc.getName().equals(cores.getDefaultCoreName()));
      info.add("instanceDir", desc.getInstanceDir());
      // None of the following are guaranteed to be present in a not-yet-loaded core.
      String tmp = desc.getDataDir();
      if (StringUtils.isNotBlank(tmp)) info.add("dataDir", tmp);
      tmp = desc.getConfigName();
      if (StringUtils.isNotBlank(tmp)) info.add("config", tmp);
      tmp = desc.getSchemaName();
      if (StringUtils.isNotBlank(tmp)) info.add("schema", tmp);
      info.add("isLoaded", "false");
    }
  } else {
    try (SolrCore core = cores.getCore(cname)) {
      if (core != null) {
        info.add("name", core.getName());
        info.add("isDefaultCore", core.getName().equals(cores.getDefaultCoreName()));
        info.add("instanceDir", normalizePath(core.getResourceLoader().getInstanceDir()));
        info.add("dataDir", normalizePath(core.getDataDir()));
        info.add("config", core.getConfigResource());
        info.add("schema", core.getSchemaResource());
        info.add("startTime", new Date(core.getStartTime()));
        info.add("uptime", System.currentTimeMillis() - core.getStartTime());
        if (isIndexInfoNeeded) {
          RefCounted<SolrIndexSearcher> searcher = core.getSearcher();
          try {
            SimpleOrderedMap<Object> indexInfo = LukeRequestHandler.getIndexInfo(searcher.get().getIndexReader());
            long size = getIndexSize(core);
            indexInfo.add("sizeInBytes", size);
            indexInfo.add("size", NumberUtils.readableSize(size));
            info.add("index", indexInfo);
          } finally {
            searcher.decref();
          }
        }
      }
    }
  }
  return info;
}
 
开发者ID:europeana,项目名称:search,代码行数:56,代码来源:CoreAdminHandler.java

示例2: getCoreStatus

import org.apache.solr.core.CoreDescriptor; //导入方法依赖的package包/类
/**
 * Returns the core status for a particular core.
 * @param cores - the enclosing core container
 * @param cname - the core to return
 * @param isIndexInfoNeeded - add what may be expensive index information. NOT returned if the core is not loaded
 * @return - a named list of key/value pairs from the core.
 * @throws IOException - LukeRequestHandler can throw an I/O exception
 */
protected NamedList<Object> getCoreStatus(CoreContainer cores, String cname, boolean isIndexInfoNeeded)  throws IOException {
  NamedList<Object> info = new SimpleOrderedMap<Object>();

  if (!cores.isLoaded(cname)) { // Lazily-loaded core, fill in what we can.
    // It would be a real mistake to load the cores just to get the status
    CoreDescriptor desc = cores.getUnloadedCoreDescriptor(cname);
    if (desc != null) {
      info.add("name", desc.getName());
      info.add("isDefaultCore", desc.getName().equals(cores.getDefaultCoreName()));
      info.add("instanceDir", desc.getInstanceDir());
      // None of the following are guaranteed to be present in a not-yet-loaded core.
      String tmp = desc.getDataDir();
      if (StringUtils.isNotBlank(tmp)) info.add("dataDir", tmp);
      tmp = desc.getConfigName();
      if (StringUtils.isNotBlank(tmp)) info.add("config", tmp);
      tmp = desc.getSchemaName();
      if (StringUtils.isNotBlank(tmp)) info.add("schema", tmp);
      info.add("isLoaded", "false");
    }
  } else {
    SolrCore core = cores.getCore(cname);
    if (core != null) {
      try {
        info.add("name", core.getName());
        info.add("isDefaultCore", core.getName().equals(cores.getDefaultCoreName()));
        info.add("instanceDir", normalizePath(core.getResourceLoader().getInstanceDir()));
        info.add("dataDir", normalizePath(core.getDataDir()));
        info.add("config", core.getConfigResource());
        info.add("schema", core.getSchemaResource());
        info.add("startTime", new Date(core.getStartTime()));
        info.add("uptime", System.currentTimeMillis() - core.getStartTime());
        if (isIndexInfoNeeded) {
          RefCounted<SolrIndexSearcher> searcher = core.getSearcher();
          try {
            SimpleOrderedMap<Object> indexInfo = LukeRequestHandler.getIndexInfo(searcher.get().getIndexReader());
            long size = getIndexSize(core);
            indexInfo.add("sizeInBytes", size);
            indexInfo.add("size", NumberUtils.readableSize(size));
            info.add("index", indexInfo);
          } finally {
            searcher.decref();
          }
        }
      } finally {
        core.close();
      }
    }
  }
  return info;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:59,代码来源:CoreAdminHandler.java


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