當前位置: 首頁>>代碼示例>>Java>>正文


Java CoreContainer.getCores方法代碼示例

本文整理匯總了Java中org.apache.solr.core.CoreContainer.getCores方法的典型用法代碼示例。如果您正苦於以下問題:Java CoreContainer.getCores方法的具體用法?Java CoreContainer.getCores怎麽用?Java CoreContainer.getCores使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.solr.core.CoreContainer的用法示例。


在下文中一共展示了CoreContainer.getCores方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkForSingleIndex

import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
private void checkForSingleIndex(JettySolrRunner jetty) {
  CoreContainer cores = ((SolrDispatchFilter) jetty.getDispatchFilter().getFilter()).getCores();
  Collection<SolrCore> theCores = cores.getCores();
  for (SolrCore core : theCores) {
    String ddir = core.getDataDir();
    CachingDirectoryFactory dirFactory = (CachingDirectoryFactory) core.getDirectoryFactory();
    synchronized (dirFactory) {
      Set<String> livePaths = dirFactory.getLivePaths();
      // one for data, one for hte index under data
      assertEquals(livePaths.toString(), 2, livePaths.size());
      // :TODO: assert that one of the paths is a subpath of hte other
    }
    if (dirFactory instanceof StandardDirectoryFactory) {
      System.out.println(Arrays.asList(new File(ddir).list()));
      assertEquals(Arrays.asList(new File(ddir).list()).toString(), 1, indexDirCount(ddir));
    }
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:19,代碼來源:TestReplicationHandler.java

示例2: checkInstanceDirs

import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
private void checkInstanceDirs(JettySolrRunner jetty) {
  CoreContainer cores = ((SolrDispatchFilter) jetty.getDispatchFilter()
      .getFilter()).getCores();
  Collection<SolrCore> theCores = cores.getCores();
  for (SolrCore core : theCores) {
    if (!oldStyleSolrXml) {
      // look for core props file
      assertTrue("Could not find expected core.properties file",
          new File((String) core.getStatistics().get("instanceDir"),
              "core.properties").exists());
    }
    
    assertEquals(
       new File(SolrResourceLoader.normalizeDir(jetty.getSolrHome() + File.separator
            + core.getName())).getAbsolutePath(),
        new File(SolrResourceLoader.normalizeDir((String) core.getStatistics().get(
            "instanceDir"))).getAbsolutePath());
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:20,代碼來源:CollectionsAPIDistributedZkTest.java

示例3: execute

import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
@Override
public void execute(JobExecutionContext jec) throws JobExecutionException
{

    AlfrescoCoreAdminHandler adminHandler = (AlfrescoCoreAdminHandler) jec.getJobDetail().getJobDataMap()
                .get(JOBDATA_ADMIN_HANDLER_KEY);
    CoreContainer coreContainer = adminHandler.getCoreContainer();
    for (SolrCore core : coreContainer.getCores())
    {
        logIfDebugEnabled("About to enter synchronized block for core " + core.getName());
        // Prevents other threads from creating trackers for this core before its trackers are done registering
        synchronized (core)
        {
            logIfDebugEnabled("Entered synchronized block for core " + core.getName());

            String coreName = core.getName();
            TrackerRegistry trackerRegistry = adminHandler.getTrackerRegistry();
            if (!trackerRegistry.hasTrackersForCore(coreName))
            {
                registerForCore(adminHandler, coreContainer, core, coreName, trackerRegistry);
            }

            logIfDebugEnabled("Exiting synchronized block for core " + core.getName());
        }
    }
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:27,代碼來源:CoreWatcherJob.java

示例4: enableAutoSoftCommit

import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
protected void enableAutoSoftCommit(int time) {
  log.info("Turning on auto soft commit: " + time);
  for (List<CloudJettyRunner> jettyList : shardToJetty.values()) {
    for (CloudJettyRunner jetty : jettyList) {
      CoreContainer cores = ((SolrDispatchFilter) jetty.jetty
          .getDispatchFilter().getFilter()).getCores();
      for (SolrCore core : cores.getCores()) {
        ((DirectUpdateHandler2) core.getUpdateHandler())
            .getSoftCommitTracker().setTimeUpperBound(time);
      }
    }
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:14,代碼來源:AbstractFullDistribZkTestBase.java

示例5: testNoWriter

import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
/**
 * Verify that things still work if an IW has not been opened (and hence the CommitPoints have not been communicated to the deletion policy)
 */
public void testNoWriter() throws Exception {
  useFactory(null);    // force a persistent directory

  // read-only setting (no opening from indexwriter)
  System.setProperty("solr.tests.nrtMode", "false");
  try {
  // stop and start so they see the new directory setting
  slaveJetty.stop();
  masterJetty.stop();
  slaveJetty.start(true);
  masterJetty.start(true);

  index(slaveClient, "id", "123456");
  slaveClient.commit();
  slaveJetty.stop();
  slaveJetty.start(true);
  } finally {
    System.clearProperty("solr.tests.nrtMode"); // dont mess with other tests
  }

  // Currently we open a writer on-demand.  This is to test that we are correctly testing
  // the code path when SolrDeletionPolicy.getLatestCommit() returns null.
  // When we are using an ephemeral directory, an IW will always be opened to create the index and hence
  // getLatestCommit will always be non-null.
  CoreContainer cores = ((SolrDispatchFilter) slaveJetty.getDispatchFilter().getFilter()).getCores();
  Collection<SolrCore> theCores = cores.getCores();
  assertEquals(1, theCores.size());
  SolrCore core = (SolrCore)theCores.toArray()[0];
  assertNull( core.getDeletionPolicy().getLatestCommit() );


  pullFromMasterToSlave();  // this will cause SnapPuller to be invoked and we will test when SolrDeletionPolicy.getLatestCommit() returns null

  resetFactory();
}
 
開發者ID:europeana,項目名稱:search,代碼行數:39,代碼來源:TestReplicationHandler.java

示例6: checkForSingleIndex

import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
private void checkForSingleIndex(JettySolrRunner jetty) {
  CoreContainer cores = ((SolrDispatchFilter) jetty.getDispatchFilter().getFilter()).getCores();
  Collection<SolrCore> theCores = cores.getCores();
  for (SolrCore core : theCores) {
    String ddir = core.getDataDir();
    CachingDirectoryFactory dirFactory = (CachingDirectoryFactory) core.getDirectoryFactory();
    synchronized (dirFactory) {
      assertEquals(dirFactory.getPaths().toString(), 2, dirFactory.getPaths().size());
    }
    if (dirFactory instanceof StandardDirectoryFactory) {
      System.out.println(Arrays.asList(new File(ddir).list()));
      assertEquals(Arrays.asList(new File(ddir).list()).toString(), 1, indexDirCount(ddir));
    }
  }
}
 
開發者ID:pkarmstr,項目名稱:NYBC,代碼行數:16,代碼來源:TestReplicationHandler.java


注:本文中的org.apache.solr.core.CoreContainer.getCores方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。