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


Java ZkStateReader.CORE_NAME_PROP属性代码示例

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


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

示例1: ClientThread

public ClientThread(ElectorSetup es, String shard, int nodeNumber, long runLeaderDelay) throws Exception {
  super("Thread-" + shard + nodeNumber);
  this.shard = shard;
  this.nodeName = shard + nodeNumber;
  this.runLeaderDelay = runLeaderDelay;

  props = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, Integer.toString(nodeNumber), ZkStateReader.CORE_NAME_PROP, "");

  this.es = es;
  if (this.es == null) {
    this.es = new ElectorSetup(new OnReconnect() {
      @Override
      public void command() {
        try {
          setupOnConnect();
        } catch (Throwable t) {
        }
      }
    });
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:LeaderElectionTest.java

示例2: deleteCoreNode

private void deleteCoreNode(String collectionName, String replicaName, Replica replica, String core) throws KeeperException, InterruptedException {
  ZkNodeProps m = new ZkNodeProps(
      Overseer.QUEUE_OPERATION, Overseer.DELETECORE,
      ZkStateReader.CORE_NAME_PROP, core,
      ZkStateReader.NODE_NAME_PROP, replica.getStr(ZkStateReader.NODE_NAME_PROP),
      ZkStateReader.COLLECTION_PROP, collectionName,
      ZkStateReader.CORE_NODE_NAME_PROP, replicaName);
  Overseer.getInQueue(zkStateReader.getZkClient()).offer(ZkStateReader.toJSON(m));
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:OverseerCollectionProcessor.java

示例3: testMaxRetries

private void testMaxRetries() throws IOException {
  final MockStreamingSolrServers ss = new MockStreamingSolrServers(updateShardHandler);
  SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(ss, 5, 0);
  ss.setExp(Exp.CONNECT_EXCEPTION);
  ArrayList<Node> nodes = new ArrayList<>();
  final HttpSolrServer solrclient1 = (HttpSolrServer) clients.get(0);
  
  final AtomicInteger retries = new AtomicInteger();
  ZkNodeProps nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, solrclient1.getBaseURL(), ZkStateReader.CORE_NAME_PROP, "");
  RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1") {
    @Override
    public boolean checkRetry() {
      retries.incrementAndGet();
      return true;
    }
  };
  
  nodes.add(retryNode);
  
  AddUpdateCommand cmd = new AddUpdateCommand(null);
  cmd.solrDoc = sdoc("id", id.incrementAndGet());
  ModifiableSolrParams params = new ModifiableSolrParams();

  cmdDistrib.distribAdd(cmd, nodes, params);
  cmdDistrib.finish();
  
  assertEquals(6, retries.get());
  
  assertEquals(1, cmdDistrib.getErrors().size());
}
 
开发者ID:europeana,项目名称:search,代码行数:30,代码来源:SolrCmdDistributorTest.java

示例4: testBasic

@Test
public void testBasic() throws Exception {
  LeaderElector elector = new LeaderElector(zkClient);
  ZkNodeProps props = new ZkNodeProps(ZkStateReader.BASE_URL_PROP,
      "http://127.0.0.1/solr/", ZkStateReader.CORE_NAME_PROP, "");
  ElectionContext context = new ShardLeaderElectionContextBase(elector,
      "shard2", "collection1", "dummynode1", props, zkStateReader);
  elector.setup(context);
  elector.joinElection(context, false);
  assertEquals("http://127.0.0.1/solr/",
      getLeaderUrl("collection1", "shard2"));
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:LeaderElectionTest.java

示例5: testAssignNode

@Test
public void testAssignNode() throws Exception {
  String cname = "collection1";
  
  Map<String,DocCollection> collectionStates = new HashMap<>();
  
  Map<String,Slice> slices = new HashMap<>();
  
  Map<String,Replica> replicas = new HashMap<>();
  
  ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, "state", 
      ZkStateReader.STATE_PROP, "ACTIVE", 
      ZkStateReader.BASE_URL_PROP, "0.0.0.0", 
      ZkStateReader.CORE_NAME_PROP, "core1",
      ZkStateReader.ROLES_PROP, null,
      ZkStateReader.NODE_NAME_PROP, "0_0_0_0",
      ZkStateReader.SHARD_ID_PROP, "shard1",
      ZkStateReader.COLLECTION_PROP, cname,
      ZkStateReader.NUM_SHARDS_PROP, "1",
      ZkStateReader.CORE_NODE_NAME_PROP, "core_node1");
  Replica replica = new Replica("core_node1" , m.getProperties());
  replicas.put("core_node1", replica);
  
  Slice slice = new Slice("slice1", replicas , new HashMap<String,Object>(0));
  slices.put("slice1", slice);
  
  DocRouter router = new ImplicitDocRouter();
  DocCollection docCollection = new DocCollection(cname, slices, new HashMap<String,Object>(0), router);

  collectionStates.put(cname, docCollection);
  
  Set<String> liveNodes = new HashSet<>();
  ClusterState state = new ClusterState(-1,liveNodes, collectionStates);
  String nodeName = Assign.assignNode("collection1", state);
  
  assertEquals("core_node2", nodeName);
}
 
开发者ID:europeana,项目名称:search,代码行数:37,代码来源:AssignTest.java


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