Package org.apache.helix.api.config

Examples of org.apache.helix.api.config.ContainerConfig


        System.out.println("CONTAINER STATUS");
        System.out.println("----------------");
        Cluster cluster = accessor.readCluster();
        Collection<Participant> participants = cluster.getParticipantMap().values();
        for (Participant participant : participants) {
          ContainerConfig containerConfig = participant.getContainerConfig();
          if (containerConfig != null) {
            System.out.println(participant.getId() + "[" + containerConfig.getId() + "]: "
                + containerConfig.getState());
          }
          if (participant.isAlive()) {
            LiveInstance runningInstance = participant.getLiveInstance();
            System.out.println("\tProcess: " + runningInstance.getProcessId());
          }
View Full Code Here


        // If a process died, we need to mark it as DISCONNECTED or if the process is ready, mark as
        // CONNECTED
        Map<ParticipantId, Participant> participantMap = cluster.getParticipantMap();
        for (ParticipantId participantId : participantMap.keySet()) {
          Participant participant = participantMap.get(participantId);
          ContainerConfig config = participant.getContainerConfig();
          if (config != null) {
            ContainerState containerState = config.getState();
            if (!participant.isAlive() && ContainerState.CONNECTED.equals(containerState)) {
              // Need to mark as disconnected if process died
              LOG.info("Participant " + participantId + " died, marking as DISCONNECTED");
              updateContainerState(cache, accessor, keyBuilder, cluster, null, participantId,
                  ContainerState.DISCONNECTED);
View Full Code Here

    // Cache participants to ensure that excess participants are stopped
    Map<ParticipantId, Participant> excessActiveContainers = Maps.newHashMap();

    for (Participant participant : participants) {
      ContainerConfig containerConfig = participant.getContainerConfig();
      if (containerConfig != null && containerConfig.getState() != null) {
        ContainerState state = containerConfig.getState();
        switch (state) {
        case ACQUIRING:
          existingContainersIdSet.add(participant.getId());
          break;
        case ACQUIRED:
View Full Code Here

      for (Participant participant : participants.values()) {
        // need a better check
        if (!participant.getId().stringify().startsWith(resource.getId().stringify())) {
          continue;
        }
        ContainerConfig containerConfig = participant.getContainerConfig();
        ContainerState containerState = ContainerState.UNDEFINED;
        ContainerId containerId = ContainerId.from("N/A");

        if (containerConfig != null) {
          containerId = containerConfig.getId();
          containerState = containerConfig.getState();
        }
        State participantState = null;
        if (serviceStateMap != null) {
          participantState = serviceStateMap.get(participant.getId());
        }
View Full Code Here

        curStateMap.put(ResourceId.from(resourceName), instanceCurStateMap.get(resourceName));
      }
    }

    // set up the container config if it exists
    ContainerConfig containerConfig = null;
    ContainerSpec containerSpec = instanceConfig.getContainerSpec();
    ContainerState containerState = instanceConfig.getContainerState();
    ContainerId containerId = instanceConfig.getContainerId();
    if (containerSpec != null || containerState != null || containerId != null) {
      containerConfig = new ContainerConfig(containerId, containerSpec, containerState);
    }

    // Populate the logical class
    ParticipantConfig participantConfig = ParticipantConfig.from(instanceConfig);
    return new Participant(participantConfig, liveInstance, curStateMap, msgMap, containerConfig);
View Full Code Here

      List<Participant> containersToStart = Lists.newArrayList();
      List<Participant> containersToStop = Lists.newArrayList();
      List<Participant> containersToRelease = Lists.newArrayList();
      int stopCount = 0;
      for (Participant participant : participants) {
        ContainerConfig containerConfig = participant.getContainerConfig();
        if (containerConfig != null && containerConfig.getState() != null) {
          ContainerState state = containerConfig.getState();
          switch (state) {
          case ACQUIRED:
            // acquired containers are ready to start
            containersToStart.add(participant);
            break;
          case CONNECTED:
            // stop at most one active at a time, wait for everything to be up first
            if (stopCount < 1 && _askCount >= MAX_PARTICIPANTS) {
              containersToStop.add(participant);
              stopCount++;
            }
            break;
          case HALTED:
            // halted containers can be released
            containersToRelease.add(participant);
            break;
          default:
            break;
          }
          ContainerId containerId = containerConfig.getId();
          if (containerId != null) {
            _containerParticipants.put(containerId, participant.getId());
            _states.put(containerId, state);
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.helix.api.config.ContainerConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.