本文整理汇总了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));
}
}
}
示例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());
}
}
示例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());
}
}
}
示例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);
}
}
}
}
示例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();
}
示例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));
}
}
}