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


Java ConcurrentUpdateSolrServer.blockUntilFinished方法代码示例

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


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

示例1: 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;
}
 
开发者ID:europeana,项目名称:search,代码行数:25,代码来源:FullSolrCloudDistribCmdsTest.java

示例2: 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));
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:SolrExampleStreamingTest.java

示例3: testWaitOptions

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入方法依赖的package包/类
public void testWaitOptions() throws Exception {
  // SOLR-3903
  final List<Throwable> failures = new ArrayList<Throwable>();
  ConcurrentUpdateSolrServer s = new ConcurrentUpdateSolrServer
    (jetty.getBaseUrl().toString(), 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));
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:34,代码来源:SolrExampleStreamingTest.java

示例4: testIndexingWithSuss

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入方法依赖的package包/类
private void testIndexingWithSuss() throws Exception {
  ConcurrentUpdateSolrServer suss = new ConcurrentUpdateSolrServer(
      ((HttpSolrServer) clients.get(0)).getBaseURL(), 3, 1);
  suss.setConnectionTimeout(15000);
  suss.setSoTimeout(30000);
  for (int i=100; i<150; i++) {
    index_specific(suss, id, i);      
  }
  suss.blockUntilFinished();
  
  commit();
  
  checkShardConsistency();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:15,代码来源:FullSolrCloudDistribCmdsTest.java

示例5: blockUntilFinished

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入方法依赖的package包/类
public synchronized void blockUntilFinished() {
  for (ConcurrentUpdateSolrServer server : solrServers.values()) {
    server.blockUntilFinished();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:6,代码来源:StreamingSolrServers.java

示例6: main

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  // String addr = "http://odin.local:80/solr";
  // String addr = "http://odin.local:8983/solr";
  String addr = "http://127.0.0.1:8983/solr";

  int i = 0;
  final int nDocs = Integer.parseInt(args[i++]);
  final int nProducers = Integer.parseInt(args[i++]);
  final int nConnections = Integer.parseInt(args[i++]);
  final int maxSleep = Integer.parseInt(args[i++]);

  ConcurrentUpdateSolrServer sserver = null;

  // server = sserver = new ConcurrentUpdateSolrServer(addr,32,8);
  server = sserver = new ConcurrentUpdateSolrServer(addr,64,nConnections);

  server.deleteByQuery("*:*");
  server.commit();

  long start = System.currentTimeMillis();

  final int docsPerThread = nDocs / nProducers;

  Thread[] threads = new Thread[nProducers];

  for (int threadNum = 0; threadNum<nProducers; threadNum++) {
    final int base = threadNum * docsPerThread;

    threads[threadNum] = new Thread("add-thread"+i) {
      @Override
      public void run(){
        try {
          indexDocs(base, docsPerThread, maxSleep);
        } catch (Exception e) {
          System.out.println("###############################CAUGHT EXCEPTION");
          e.printStackTrace();
          ex = e;
        }
      }
    };
    threads[threadNum].start();
  }

  // optional: wait for commit?

  for (int threadNum = 0; threadNum<nProducers; threadNum++) {
    threads[threadNum].join();
  }

  if (sserver != null) {
    sserver.blockUntilFinished();
  }

  long end = System.currentTimeMillis();
  System.out.println("time="+(end-start) + " throughput="+(nDocs*1000/(end-start)) + " Exception="+ex);

  // should server threads be marked as daemon?
  // need a server.close()!!!
}
 
开发者ID:europeana,项目名称:search,代码行数:60,代码来源:TestSolrJ.java


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