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


Java PreConnectCallback类代码示例

本文整理汇总了Java中org.apache.helix.PreConnectCallback的典型用法代码示例。如果您正苦于以下问题:Java PreConnectCallback类的具体用法?Java PreConnectCallback怎么用?Java PreConnectCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ParticipantManager

import org.apache.helix.PreConnectCallback; //导入依赖的package包/类
public ParticipantManager(HelixManager manager, ZkClient zkclient, int sessionTimeout,
    LiveInstanceInfoProvider liveInstanceInfoProvider, List<PreConnectCallback> preConnectCallbacks) {
  _zkclient = zkclient;
  _manager = manager;
  _clusterName = manager.getClusterName();
  _instanceName = manager.getInstanceName();
  _keyBuilder = new PropertyKey.Builder(_clusterName);
  _sessionId = manager.getSessionId();
  _sessionTimeout = sessionTimeout;
  _configAccessor = manager.getConfigAccessor();
  _instanceType = manager.getInstanceType();
  _helixAdmin = manager.getClusterManagmentTool();
  _dataAccessor = (ZKHelixDataAccessor) manager.getHelixDataAccessor();
  _messagingService = (DefaultMessagingService) manager.getMessagingService();
  _stateMachineEngine = manager.getStateMachineEngine();
  _liveInstanceInfoProvider = liveInstanceInfoProvider;
  _preConnectCallbacks = preConnectCallbacks;
}
 
开发者ID:apache,项目名称:helix,代码行数:19,代码来源:ParticipantManager.java

示例2: handleNewSession

import org.apache.helix.PreConnectCallback; //导入依赖的package包/类
/**
 * Handle new session for a participang.
 * @throws Exception
 */
public void handleNewSession() throws Exception {
  joinCluster();

  /**
   * Invoke PreConnectCallbacks
   */
  for (PreConnectCallback callback : _preConnectCallbacks) {
    callback.onPreConnect();
  }

  createLiveInstance();
  carryOverPreviousCurrentState();

  /**
   * setup message listener
   */
  setupMsgHandler();
}
 
开发者ID:apache,项目名称:helix,代码行数:23,代码来源:ParticipantManager.java

示例3: addPreConnectCallback

import org.apache.helix.PreConnectCallback; //导入依赖的package包/类
@Override
public void addPreConnectCallback(PreConnectCallback callback) {
  // TODO Auto-generated method stub
}
 
开发者ID:apache,项目名称:helix,代码行数:5,代码来源:MockManager.java

示例4: addPreConnectCallback

import org.apache.helix.PreConnectCallback; //导入依赖的package包/类
@Override
public void addPreConnectCallback(PreConnectCallback callback) {
  // TODO Auto-generated method stub

}
 
开发者ID:apache,项目名称:helix,代码行数:6,代码来源:DummyClusterManager.java

示例5: HelixBrokerStarter

import org.apache.helix.PreConnectCallback; //导入依赖的package包/类
public HelixBrokerStarter(String brokerHost, String helixClusterName, String zkServer, Configuration pinotHelixProperties)
    throws Exception {
  LOGGER.info("Starting Pinot broker");

  _liveInstancesListener = new LiveInstancesChangeListenerImpl(helixClusterName);

  _pinotHelixProperties = DefaultHelixBrokerConfig.getDefaultBrokerConf(pinotHelixProperties);

  if (brokerHost == null) {
    brokerHost = NetUtil.getHostAddress();
  }

  final String brokerId =
      _pinotHelixProperties.getString(
              CommonConstants.Helix.Instance.INSTANCE_ID_KEY,
              CommonConstants.Helix.PREFIX_OF_BROKER_INSTANCE
                      + brokerHost
                      + "_"
                      + _pinotHelixProperties.getInt(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT,
                  CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT));

  _pinotHelixProperties.addProperty(CommonConstants.Broker.CONFIG_OF_BROKER_ID, brokerId);
  setupHelixSystemProperties();

  // Remove all white-spaces from the list of zkServers (if any).
  String zkServers = zkServer.replaceAll("\\s+", "");

  LOGGER.info("Connecting Helix components");
  // Connect spectator Helix manager.
  _spectatorHelixManager =
      HelixManagerFactory.getZKHelixManager(helixClusterName, brokerId, InstanceType.SPECTATOR, zkServers);
  _spectatorHelixManager.connect();
  _helixAdmin = _spectatorHelixManager.getClusterManagmentTool();
  _propertyStore = _spectatorHelixManager.getHelixPropertyStore();
  _helixExternalViewBasedRouting = new HelixExternalViewBasedRouting(_propertyStore, _spectatorHelixManager,
      pinotHelixProperties.subset(ROUTING_TABLE_PARAMS_SUBSET_KEY));
  _brokerServerBuilder = startBroker(_pinotHelixProperties);
  _metricsRegistry = _brokerServerBuilder.getMetricsRegistry();
  ClusterChangeMediator clusterChangeMediator =
      new ClusterChangeMediator(_helixExternalViewBasedRouting, _brokerServerBuilder.getBrokerMetrics());
  _spectatorHelixManager.addExternalViewChangeListener(clusterChangeMediator);
  _spectatorHelixManager.addInstanceConfigChangeListener(clusterChangeMediator);
  _spectatorHelixManager.addLiveInstanceChangeListener(_liveInstancesListener);

  // Connect participant Helix manager.
  _helixManager =
      HelixManagerFactory.getZKHelixManager(helixClusterName, brokerId, InstanceType.PARTICIPANT, zkServers);
  StateMachineEngine stateMachineEngine = _helixManager.getStateMachineEngine();
  StateModelFactory<?> stateModelFactory =
      new BrokerResourceOnlineOfflineStateModelFactory(_spectatorHelixManager, _propertyStore, _helixExternalViewBasedRouting);
  stateMachineEngine.registerStateModelFactory(BrokerResourceOnlineOfflineStateModelFactory.getStateModelDef(),
      stateModelFactory);
  _helixManager.connect();
  addInstanceTagIfNeeded(helixClusterName, brokerId);

  // Register the service status handler
  ServiceStatus.setServiceStatusCallback(
      new ServiceStatus.MultipleCallbackServiceStatusCallback(ImmutableList.of(
          new ServiceStatus.IdealStateAndCurrentStateMatchServiceStatusCallback(_helixManager, helixClusterName, brokerId),
          new ServiceStatus.IdealStateAndExternalViewMatchServiceStatusCallback(_helixManager, helixClusterName, brokerId)
      )));

  _brokerServerBuilder.getBrokerMetrics().addCallbackGauge(
      "helix.connected", new Callable<Long>() {
        @Override
        public Long call() throws Exception {
          return _helixManager.isConnected() ? 1L : 0L;
        }
      });

  _helixManager.addPreConnectCallback(
      new PreConnectCallback() {
        @Override
        public void onPreConnect() {
          _brokerServerBuilder.getBrokerMetrics()
          .addMeteredGlobalValue(BrokerMeter.HELIX_ZOOKEEPER_RECONNECTS, 1L);
        }
      });
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:80,代码来源:HelixBrokerStarter.java

示例6: addPreConnectCallback

import org.apache.helix.PreConnectCallback; //导入依赖的package包/类
@Override
public void addPreConnectCallback(PreConnectCallback callback) {
  throw new IllegalStateException("Not implemented");
}
 
开发者ID:linkedin,项目名称:ambry,代码行数:5,代码来源:MockHelixManager.java


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