本文整理汇总了Java中org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer类的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentUpdateSolrServer类的具体用法?Java ConcurrentUpdateSolrServer怎么用?Java ConcurrentUpdateSolrServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConcurrentUpdateSolrServer类属于org.apache.solr.client.solrj.impl包,在下文中一共展示了ConcurrentUpdateSolrServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getXMLFilter
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public XMLFilter getXMLFilter(ArgFactory arf, InputCommandFactory.InputCommand inputBase, CommandType maxType) {
if (!init(parser.parse(arf.getArgs(parser.recognizedOptions().keySet())), inputBase)) {
return null;
}
CommandFactory.conditionalInit(first, inputBase, EXPECT_INPUT);
SAXSolrPoster ssp = new SAXSolrPoster();
ssp.setServer(new ConcurrentUpdateSolrServer(solrURL, queueSize, threadCount));
if (first && inputBase.getFilesFrom() != null) {
ssp.setInputType(QueueSourceXMLFilter.InputType.indirect);
if (inputBase.getDelim() != null) {
ssp.setDelimiterPattern(Pattern.compile(inputBase.getDelim(), Pattern.LITERAL));
}
}
return ssp;
}
示例2: testIndexingWithSuss
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
private long testIndexingWithSuss(long docId) throws Exception {
ConcurrentUpdateSolrServer suss = new ConcurrentUpdateSolrServer(
((HttpSolrServer) clients.get(0)).getBaseURL(), 10, 2);
QueryResponse results = query(cloudClient);
long beforeCount = results.getResults().getNumFound();
int cnt = TEST_NIGHTLY ? 2933 : 313;
try {
suss.setConnectionTimeout(120000);
for (int i = 0; i < cnt; i++) {
index_specific(suss, id, docId++, "text_t", "some text so that it not's negligent work to parse this doc, even though it's still a pretty short doc");
}
suss.blockUntilFinished();
commit();
checkShardConsistency();
assertDocCounts(VERBOSE);
} finally {
suss.shutdown();
}
results = query(cloudClient);
assertEquals(beforeCount + cnt, results.getResults().getNumFound());
return docId;
}
示例3: FullThrottleStopableIndexingThread
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
public FullThrottleStopableIndexingThread(List<SolrServer> clients,
String id, boolean doDeletes) {
super(controlClient, cloudClient, id, doDeletes);
setName("FullThrottleStopableIndexingThread");
setDaemon(true);
this.clients = clients;
HttpClientUtil.setConnectionTimeout(httpClient, 15000);
HttpClientUtil.setSoTimeout(httpClient, 15000);
suss = new ConcurrentUpdateSolrServer(
((HttpSolrServer) clients.get(0)).getBaseURL(), httpClient, 8,
2) {
@Override
public void handleError(Throwable ex) {
log.warn("suss error", ex);
}
};
}
示例4: FullThrottleStopableIndexingThread
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
public FullThrottleStopableIndexingThread(List<SolrServer> clients,
int startI, boolean doDeletes) {
super(startI, doDeletes);
setName("FullThrottleStopableIndexingThread");
setDaemon(true);
this.clients = clients;
HttpClientUtil.setConnectionTimeout(httpClient, 15000);
HttpClientUtil.setSoTimeout(httpClient, 15000);
suss = new ConcurrentUpdateSolrServer(
((HttpSolrServer) clients.get(0)).getBaseURL(), httpClient, 8,
2) {
@Override
public void handleError(Throwable ex) {
log.warn("suss error", ex);
}
};
}
示例5: buildUpdateSolrServer
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
/**
* 建造更新用Server
*/
private void buildUpdateSolrServer() {
this.validConf(); // 必须是已配置的对象
if (this.isSingle()) { // 必须是单服务器节点
Type type = this.conf.getType();
// 标准SolrServer
if (type.accept(HttpSolrServer.class)) {
this.httpSolrServer = this.buildHttpSolrServer();
}
// 更新用SolrServer
if (type.accept(ConcurrentUpdateSolrServer.class)) {
this.updateSolrServer = this.buildConcurrentUpdateSolrServer();
} else if (type.accept(HttpSolrServer.class)) {
this.updateSolrServer = this.httpSolrServer;
}
}
this.updateSolrServerBuilt = true;
}
示例6: accept
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public boolean accept(Class<?> solrServerClass) {
if (solrServerClass == null) {
return false;
}
if (ConcurrentUpdateSolrServer.class.equals(solrServerClass)) {
return true;
}
if (HttpSolrServer.class.equals(solrServerClass)) {
return true;
}
if (this.accept(solrServerClass.getSuperclass())) {
return true;
}
return false;
}
示例7: testFactory
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Test
@Ignore
public void testFactory() {
assertNotNull(masterFactory);
SolrServer solrServer = this.masterFactory.getUpdateSolrServer();
assertTrue(solrServer instanceof ConcurrentUpdateSolrServer);
solrServer = this.masterFactory.getUpdateSolrServer(true);
assertTrue(solrServer.getClass().equals(HttpSolrServer.class));
solrServer = this.masterFactory.getQuerySolrServer();
assertTrue(solrServer.getClass().equals(HttpSolrServer.class));
assertNotNull(slavesFactory);
solrServer = this.slavesFactory.getUpdateSolrServer();
assertTrue(solrServer == null);
solrServer = this.slavesFactory.getUpdateSolrServer(true);
assertTrue(solrServer == null);
solrServer = this.slavesFactory.getQuerySolrServer();
assertTrue(solrServer instanceof LBHttpSolrServer);
}
示例8: concurrentUpdateSolrServer
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
/**
* Uses the {@link HttpSolrServer} to index some data to Solr.
*
* @throws Exception in case of I/O or index failure.
*/
@Test
public void concurrentUpdateSolrServer() throws Exception {
final int bufferSize = 2; // commit each 2 albums
final int threadsNo = 2; // Use two indexer threads
// 1. Create a new instance of HttpSolrServer
// Note that we are simply repeating the same server three times, in order to "simulate" a
// scenario with three searchers.
// In a real context we would have three different urls.
solr = new ConcurrentUpdateSolrServer(SOLR_URI, bufferSize, threadsNo);
// 2. Create some data
final List<SolrInputDocument> albums = sampleData();
// 3. Add those data
solr.add(albums);
// 4. Commit
solr.commit();
// 5. Verify
verify();
}
示例9: shutdown
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public void shutdown() {
if (server instanceof ConcurrentUpdateSolrServer) {
((ConcurrentUpdateSolrServer) server).blockUntilFinished();
}
server.shutdown();
}
示例10: testWaitOptions
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
public void testWaitOptions() throws Exception {
// SOLR-3903
final List<Throwable> failures = new ArrayList<>();
ConcurrentUpdateSolrServer s = new ConcurrentUpdateSolrServer
(jetty.getBaseUrl().toString() + "/collection1", 2, 2) {
@Override
public void handleError(Throwable ex) {
failures.add(ex);
}
};
int docId = 42;
for (UpdateRequest.ACTION action : EnumSet.allOf(UpdateRequest.ACTION.class)) {
for (boolean waitSearch : Arrays.asList(true, false)) {
for (boolean waitFlush : Arrays.asList(true, false)) {
UpdateRequest updateRequest = new UpdateRequest();
SolrInputDocument document = new SolrInputDocument();
document.addField("id", docId++ );
updateRequest.add(document);
updateRequest.setAction(action, waitSearch, waitFlush);
s.request(updateRequest);
}
}
}
s.commit();
s.blockUntilFinished();
s.shutdown();
if (0 != failures.size()) {
assertEquals(failures.size() + " Unexpected Exception, starting with...",
null, failures.get(0));
}
}
示例11: createNewSolrServer
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public SolrServer createNewSolrServer() {
ConcurrentUpdateSolrServer s = (ConcurrentUpdateSolrServer)super.createNewSolrServer();
s.setParser(new BinaryResponseParser());
s.setRequestWriter(new BinaryRequestWriter());
return s;
}
示例12: commitTransaction
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public void commitTransaction() throws SolrServerException, IOException {
LOGGER.trace("commitTransaction");
if (batch.size() > 0) {
loadBatch();
}
if (numLoadedDocs > 0) {
if (server instanceof ConcurrentUpdateSolrServer) {
((ConcurrentUpdateSolrServer) server).blockUntilFinished();
}
}
}
示例13: afterPropertiesSet
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
if (querySolrServer instanceof HttpSolrServer) {
HttpSolrServer httpSolrServer = (HttpSolrServer) querySolrServer;
this.updateSolrServer = new ConcurrentUpdateSolrServer(httpSolrServer.getBaseURL(), httpSolrServer.getHttpClient(), 20, 4);
} else {
this.updateSolrServer = querySolrServer;
}
}
示例14: createAndConfigure
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public SolrServer createAndConfigure(final String role, final Configuration<Map<String, Object>> configuration) {
return new ConcurrentUpdateSolrServer(
configuration.getParameter(role + ADDRESS, DEFAULT_ADDRESS),
configuration.getParameter(role + QUEUE_SIZE, DEFAULT_QUEUE_SIZE),
configuration.getParameter(role + THREAD_COUNT, DEFAULT_THREAD_COUNT));
}
示例15: init
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
public void init() {
HttpClientBuilder clientBuilder = HttpClientBuilder.create();
httpClient = clientBuilder.build();
searchServer = new HttpSolrServer(solrUrl, httpClient);
searchServer.setRequestWriter(new BinaryRequestWriter());
updateServer = new ConcurrentUpdateSolrServer(solrUrl, 5000, 10);
updateServer.setRequestWriter(new BinaryRequestWriter());
}