gpt4 book ai didi

zu.core.cluster.ZuCluster类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 13:20:07 26 4
gpt4 key购买 nike

本文整理了Java中zu.core.cluster.ZuCluster类的一些代码示例,展示了ZuCluster类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZuCluster类的具体详情如下:
包路径:zu.core.cluster.ZuCluster
类名称:ZuCluster

ZuCluster介绍

[英]A cluster abstraction.
[中]集群抽象。

代码示例

代码示例来源:origin: com.senseidb.zu/zu-finagle

public void leaveCluster(ZuCluster cluster) throws UpdateException{
 List<EndpointStatus> endpoints = endpointMap.remove(cluster.getClusterId());
 if (endpoints != null) {
  cluster.leave(endpoints);
 }
}

代码示例来源:origin: com.senseidb/sensei-core

public void init(ZuCluster zuCluster) {
 if (zuCluster != null) {
  clusterClient = zuCluster;
  return;
 }
 String[] url = zkurl.split(":");
 String host = url[0];
 int zkPort = Integer.parseInt(url[1]);
 try {
  clusterClient = new ZuCluster(host, zkPort, clusterName, zkTimeout / 1000);
 } catch (MonitorException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: com.senseidb/sensei-core

public SenseiSysBroker(ZuCluster clusterClient, Comparator<String> versionComparator) {
 super(clusterClient, SysSenseiCoreServiceImpl.JAVA_SERIALIZER);
 _versionComparator = versionComparator;
 clusterClient.addClusterEventListener(this);
}

代码示例来源:origin: com.senseidb.zu/zu-finagle

public synchronized void joinCluster(ZuCluster cluster, Set<Integer> shards) throws JoinException, InterruptedException {
 String clusterId = cluster.getClusterId();
 List<EndpointStatus> endpoints = endpointMap.get(clusterId);
 if (endpoints == null) {
  endpoints = cluster.join(addr, shards);
  endpointMap.put(clusterId, endpoints);
 }
 else {
  throw new JoinException("cluster "+clusterId+" already joined, leave first", null);
 }
}

代码示例来源:origin: com.senseidb.zu/zu-core

leave(statuses);
leave(statuses);

代码示例来源:origin: com.senseidb/sensei-core

@SuppressWarnings({ "unchecked", "rawtypes" })
public void start(boolean available) throws Exception {
 _core.start();
 logger.info("Cluster Id: " + cluster.getClusterId());
 AbstractSenseiCoreService<SenseiRequest, SenseiResult> coreSenseiService = new CoreSenseiServiceImpl(
   _core);
 AbstractSenseiCoreService<SenseiRequest, SenseiSystemInfo> sysSenseiCoreService = new SysSenseiCoreServiceImpl(
   _core);
 SenseiCoreServiceMessageHandler<SenseiRequest, SenseiResult> senseiMsgHandler = new SenseiCoreServiceMessageHandler<SenseiRequest, SenseiResult>(
   coreSenseiService);
 SenseiCoreServiceMessageHandler<SenseiRequest, SenseiSystemInfo> senseiSysMsgHandler = new SenseiCoreServiceMessageHandler<SenseiRequest, SenseiSystemInfo>(
   sysSenseiCoreService);
 transportService.registerHandler(senseiMsgHandler);
 transportService.registerHandler(senseiSysMsgHandler);
 server.start();
 if (_externalSvc != null) {
  for (AbstractSenseiCoreService svc : _externalSvc) {
   transportService.registerHandler(new SenseiCoreServiceMessageHandler(svc));
  }
 }
 setAvailable(available);
 SenseiServerAdminMBean senseiAdminMBean = getAdminMBean();
 StandardMBean bean = new StandardMBean(senseiAdminMBean, SenseiServerAdminMBean.class);
 JmxUtil.registerMBean(bean, "name", "sensei-server-" + _id);
}

代码示例来源:origin: com.senseidb/sensei-core

public void shutdown() {
 clusterClient.shutdown();
}

代码示例来源:origin: com.senseidb/sensei-core

public void shutdown() {
 try {
  logger.info("shutting down node...");
  try {
   _core.shutdown();
   pluginRegistry.stop();
   server.leaveCluster(cluster);
   server.shutdown();
   cluster.shutdown();
   _core.getPluggableSearchEngineManager().close();
  } catch (Exception e) {
   logger.warn(e.getMessage());
  }
 } catch (Exception e) {
  logger.error(e.getMessage(), e);
 }
}

代码示例来源:origin: com.senseidb/sensei-core

public SenseiBroker(ZuCluster clusterClient) {
 super(clusterClient, CoreSenseiServiceImpl.JAVA_SERIALIZER);
 clusterClient.addClusterEventListener(this);
}

代码示例来源:origin: com.senseidb/sensei-core

private ZuCluster buildClusterClient() {
  if (clusterClient != null) return clusterClient;

  String clusterName = _senseiConf.getString(SENSEI_CLUSTER_NAME);
  String zkUrl = _senseiConf.getString(SENSEI_CLUSTER_URL);
  int zkTimeout = _senseiConf.getInt(SENSEI_CLUSTER_TIMEOUT, 300000);

  String[] url = zkUrl.split(",");
  List<InetSocketAddress> address = new ArrayList<InetSocketAddress>();
  for (int i = 0; i < url.length; ++i) {
   String[] parts = url[i].split(":");
   String host = parts[0];
   int port = Integer.parseInt(parts[1]);
   address.add(new InetSocketAddress(host, port));
  }

  try {
   clusterClient = new ZuCluster(address, clusterName, zkTimeout);
  } catch (MonitorException e) {
   throw new RuntimeException(e);
  }

  return clusterClient;
 }
}

代码示例来源:origin: com.senseidb/sensei-core

/**
 * @param clusterClient
 * @param serializer
 *          The serializer used to serialize/deserialize request/response pairs
 */
public AbstractConsistentHashBroker(ZuCluster clusterClient,
  ZuSerializer<REQUEST, RESULT> serializer) {
 super();
 _serializer = serializer;
 ZuTransportClientProxy<REQUEST, RESULT> proxy = new ZuTransportClientProxy<REQUEST, RESULT>(
   getMessageType(), _serializer);
 serviceDecorator = new ZuFinagleServiceDecorator<REQUEST, RESULT>(proxy);
 router = new ConsistentHashRoutingAlgorithm<Service<REQUEST, RESULT>>(serviceDecorator);
 clusterClient.addClusterEventListener(router);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com