本文整理匯總了Java中org.apache.solr.core.CoreContainer.shutdown方法的典型用法代碼示例。如果您正苦於以下問題:Java CoreContainer.shutdown方法的具體用法?Java CoreContainer.shutdown怎麽用?Java CoreContainer.shutdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.solr.core.CoreContainer
的用法示例。
在下文中一共展示了CoreContainer.shutdown方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: tearDown
import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
@Override
public void tearDown() throws Exception {
if (VERBOSE) {
printLayout(zkServer.getZkHost());
}
if (zkClient != null) {
zkClient.close();
}
if (reader != null) {
reader.close();
}
for (CoreContainer cc : containerMap.values()) {
if (!cc.isShutDown()) {
cc.shutdown();
}
}
zkServer.shutdown();
super.tearDown();
System.clearProperty("zkClientTimeout");
System.clearProperty("zkHost");
System.clearProperty("hostPort");
System.clearProperty("shard");
System.clearProperty("solrcloud.update.delay");
}
示例2: testGetHostName
import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
@Test
public void testGetHostName() throws Exception {
String zkDir = createTempDir("zkData").getAbsolutePath();
CoreContainer cc = null;
ZkTestServer server = new ZkTestServer(zkDir);
try {
server.run();
AbstractZkTestCase.tryCleanSolrZkNode(server.getZkHost());
AbstractZkTestCase.makeSolrZkNode(server.getZkHost());
cc = getCoreContainer();
ZkController zkController = null;
try {
zkController = new ZkController(cc, server.getZkAddress(), TIMEOUT, 10000,
"http://127.0.0.1", "8983", "solr", 0, 60000, true, new CurrentCoreDescriptorProvider() {
@Override
public List<CoreDescriptor> getCurrentDescriptors() {
// do nothing
return null;
}
});
} catch (IllegalArgumentException e) {
fail("ZkController did not normalize host name correctly");
} finally {
if (zkController != null)
zkController.close();
}
} finally {
if (cc != null) {
cc.shutdown();
}
server.shutdown();
}
}
示例3: testOptimizeDiffSchemas
import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
@Test
public void testOptimizeDiffSchemas() throws Exception {
// load up a core (why not put it on disk?)
CoreContainer cc = init();
try (SolrCore changed = cc.getCore("changed")) {
// add some documents
addDoc(changed, "id", "1", "which", "15", "text", "some stuff with which");
addDoc(changed, "id", "2", "which", "15", "text", "some stuff with which");
addDoc(changed, "id", "3", "which", "15", "text", "some stuff with which");
addDoc(changed, "id", "4", "which", "15", "text", "some stuff with which");
SolrQueryRequest req = new LocalSolrQueryRequest(changed, new NamedList<>());
changed.getUpdateHandler().commit(new CommitUpdateCommand(req, false));
// write the new schema out and make it current
FileUtils.writeStringToFile(schemaFile, withoutWhich, Charsets.UTF_8.toString());
IndexSchema iSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", changed.getSolrConfig());
changed.setLatestSchema(iSchema);
addDoc(changed, "id", "1", "text", "some stuff without which");
addDoc(changed, "id", "5", "text", "some stuff without which");
changed.getUpdateHandler().commit(new CommitUpdateCommand(req, false));
changed.getUpdateHandler().commit(new CommitUpdateCommand(req, true));
} finally {
if (cc != null) cc.shutdown();
}
}
示例4: testReadConfigName
import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
@Test
public void testReadConfigName() throws Exception {
String zkDir = createTempDir("zkData").getAbsolutePath();
CoreContainer cc = null;
ZkTestServer server = new ZkTestServer(zkDir);
try {
server.run();
AbstractZkTestCase.tryCleanSolrZkNode(server.getZkHost());
AbstractZkTestCase.makeSolrZkNode(server.getZkHost());
SolrZkClient zkClient = new SolrZkClient(server.getZkAddress(), TIMEOUT);
String actualConfigName = "firstConfig";
zkClient.makePath(ZkController.CONFIGS_ZKNODE + "/" + actualConfigName, true);
Map<String,Object> props = new HashMap<>();
props.put("configName", actualConfigName);
ZkNodeProps zkProps = new ZkNodeProps(props);
zkClient.makePath(ZkStateReader.COLLECTIONS_ZKNODE + "/"
+ COLLECTION_NAME, ZkStateReader.toJSON(zkProps),
CreateMode.PERSISTENT, true);
if (DEBUG) {
zkClient.printLayoutToStdOut();
}
zkClient.close();
cc = getCoreContainer();
ZkController zkController = new ZkController(cc, server.getZkAddress(), TIMEOUT, 10000,
"127.0.0.1", "8983", "solr", 0, 60000, true, new CurrentCoreDescriptorProvider() {
@Override
public List<CoreDescriptor> getCurrentDescriptors() {
// do nothing
return null;
}
});
try {
String configName = zkController.getZkStateReader().readConfigName(COLLECTION_NAME);
assertEquals(configName, actualConfigName);
} finally {
zkController.close();
}
} finally {
if (cc != null) {
cc.shutdown();
}
server.shutdown();
}
}
示例5: testUploadToCloud
import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
@Test
public void testUploadToCloud() throws Exception {
String zkDir = createTempDir("zkData").getAbsolutePath();
ZkTestServer server = new ZkTestServer(zkDir);
ZkController zkController = null;
boolean testFinished = false;
CoreContainer cc = null;
try {
server.run();
AbstractZkTestCase.makeSolrZkNode(server.getZkHost());
cc = getCoreContainer();
zkController = new ZkController(cc, server.getZkAddress(),
TIMEOUT, 10000, "127.0.0.1", "8983", "solr", 0, 60000, true, new CurrentCoreDescriptorProvider() {
@Override
public List<CoreDescriptor> getCurrentDescriptors() {
// do nothing
return null;
}
});
zkController.uploadToZK(new File(ExternalPaths.EXAMPLE_HOME + "/collection1/conf"),
ZkController.CONFIGS_ZKNODE + "/config1");
// uploading again should overwrite, not error...
zkController.uploadToZK(new File(ExternalPaths.EXAMPLE_HOME + "/collection1/conf"),
ZkController.CONFIGS_ZKNODE + "/config1");
if (DEBUG) {
zkController.printLayoutToStdOut();
}
testFinished = true;
} finally {
if (!testFinished & zkController != null) {
zkController.getZkClient().printLayoutToStdOut();
}
if (zkController != null) {
zkController.close();
}
if (cc != null) {
cc.shutdown();
}
server.shutdown();
}
}
示例6: testReadConfigName
import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
@Test
public void testReadConfigName() throws Exception {
String zkDir = dataDir.getAbsolutePath() + File.separator
+ "zookeeper/server1/data";
CoreContainer cc = null;
ZkTestServer server = new ZkTestServer(zkDir);
try {
server.run();
AbstractZkTestCase.tryCleanSolrZkNode(server.getZkHost());
AbstractZkTestCase.makeSolrZkNode(server.getZkHost());
SolrZkClient zkClient = new SolrZkClient(server.getZkAddress(), TIMEOUT);
String actualConfigName = "firstConfig";
zkClient.makePath(ZkController.CONFIGS_ZKNODE + "/" + actualConfigName, true);
Map<String,Object> props = new HashMap<String,Object>();
props.put("configName", actualConfigName);
ZkNodeProps zkProps = new ZkNodeProps(props);
zkClient.makePath(ZkStateReader.COLLECTIONS_ZKNODE + "/"
+ COLLECTION_NAME, ZkStateReader.toJSON(zkProps),
CreateMode.PERSISTENT, true);
if (DEBUG) {
zkClient.printLayoutToStdOut();
}
zkClient.close();
cc = getCoreContainer();
ZkController zkController = new ZkController(cc, server.getZkAddress(), TIMEOUT, 10000,
"127.0.0.1", "8983", "solr", "0", 10000, 10000, new CurrentCoreDescriptorProvider() {
@Override
public List<CoreDescriptor> getCurrentDescriptors() {
// do nothing
return null;
}
});
try {
String configName = zkController.readConfigName(COLLECTION_NAME);
assertEquals(configName, actualConfigName);
} finally {
zkController.close();
}
} finally {
if (cc != null) {
cc.shutdown();
}
server.shutdown();
}
}
示例7: testUploadToCloud
import org.apache.solr.core.CoreContainer; //導入方法依賴的package包/類
@Test
public void testUploadToCloud() throws Exception {
String zkDir = dataDir.getAbsolutePath() + File.separator
+ "zookeeper/server1/data";
ZkTestServer server = new ZkTestServer(zkDir);
ZkController zkController = null;
boolean testFinished = false;
CoreContainer cc = null;
try {
server.run();
AbstractZkTestCase.makeSolrZkNode(server.getZkHost());
cc = getCoreContainer();
zkController = new ZkController(cc, server.getZkAddress(),
TIMEOUT, 10000, "127.0.0.1", "8983", "solr", "0", 10000, 10000, new CurrentCoreDescriptorProvider() {
@Override
public List<CoreDescriptor> getCurrentDescriptors() {
// do nothing
return null;
}
});
zkController.uploadToZK(new File(ExternalPaths.EXAMPLE_HOME + "/collection1/conf"),
ZkController.CONFIGS_ZKNODE + "/config1");
// uploading again should overwrite, not error...
zkController.uploadToZK(new File(ExternalPaths.EXAMPLE_HOME + "/collection1/conf"),
ZkController.CONFIGS_ZKNODE + "/config1");
if (DEBUG) {
zkController.printLayoutToStdOut();
}
testFinished = true;
} finally {
if (!testFinished & zkController != null) {
zkController.getZkClient().printLayoutToStdOut();
}
if (zkController != null) {
zkController.close();
}
if (cc != null) {
cc.shutdown();
}
server.shutdown();
}
}