Exemplo n.º 1
0
  public DynamicFileHelixManager(
      String clusterName,
      String instanceName,
      InstanceType instanceType,
      FilePropertyStore<ZNRecord> store) {
    _clusterName = clusterName;
    _instanceName = instanceName;
    _instanceType = instanceType;

    _handlers = new ArrayList<FileCallbackHandler>();

    _store = store;
    _fileDataAccessor = new FileDataAccessor(_store, clusterName);
    _accessor = new FileHelixDataAccessor(_store, clusterName);

    _mgmtTool = new FileHelixAdmin(_store);
    _messagingService = new DefaultMessagingService(this);
    _sessionId = UUID.randomUUID().toString();
    if (instanceType == InstanceType.PARTICIPANT) {
      addLiveInstance();
      addMessageListener(_messagingService.getExecutor(), _instanceName);
    }

    _version =
        new PropertiesReader("cluster-manager-version.properties")
            .getProperty("clustermanager.version");

    _stateMachEngine = new HelixStateMachineEngine(this);

    _messagingService.registerMessageHandlerFactory(
        MessageType.STATE_TRANSITION.toString(), _stateMachEngine);
  }
Exemplo n.º 2
0
  @Override
  public void disconnect() {
    _store.stop();
    _messagingService.getExecutor().shutDown();

    _isConnected = false;
  }
Exemplo n.º 3
0
 @Override
 public void connect() {
   if (!isClusterSetup(_clusterName)) {
     throw new HelixException(
         "Initial cluster structure is not set up for cluster:" + _clusterName);
   }
   _messagingService.onConnected();
   _store.start();
   _isConnected = true;
 }