Examples of StormStatus


Examples of com.alibaba.jstorm.cluster.StormStatus

  private static Logger LOG = Logger.getLogger(Thrift.class);

  public static StormStatus topologyInitialStatusToStormStatus(
      TopologyInitialStatus tStatus) {
    if (tStatus.equals(TopologyInitialStatus.ACTIVE)) {
      return new StormStatus(StatusType.active);
    } else {
      return new StormStatus(StatusType.inactive);
    }
  }
View Full Code Here

Examples of com.alibaba.jstorm.cluster.StormStatus

          + changeStatus.getStatus() + " to " + topologyid
          + " because failed to get StormBase from ZK");
      return;
    }

    StormStatus currentStatus = stormbase.getStatus();
    if (currentStatus == null) {
      LOG.error("Cannot apply event changing status "
          + changeStatus.getStatus() + " to " + topologyid
          + " because topologyStatus is null in ZK");
      return;
    }

    // <currentStatus, Map<changingStatus, callback>>
    Map<StatusType, Map<StatusType, Callback>> callbackMap = stateTransitions(
        topologyid, currentStatus);

    // get current changingCallbacks
    Map<StatusType, Callback> changingCallbacks = callbackMap
        .get(currentStatus.getStatusType());

    if (changingCallbacks == null
        || changingCallbacks.containsKey(changeStatus) == false
        || changingCallbacks.get(changeStatus) == null) {
      String msg = "No transition for event: changing status:"
          + changeStatus.getStatus() + ", current status: "
          + currentStatus.getStatusType() + " topology-id: "
          + topologyid;
      LOG.info(msg);
      if (errorOnNoTransition) {
        throw new RuntimeException(msg);
      }
      return;
    }

    Callback callback = changingCallbacks.get(changeStatus);

    Object obj = callback.execute(args);
    if (obj != null && obj instanceof StormStatus) {
      StormStatus newStatus = (StormStatus) obj;
      // update status to ZK
      data.getStormClusterState().update_storm(topologyid, newStatus);
      LOG.info("Successfully updated " + topologyid + " as status "
          + newStatus);
    }
View Full Code Here

Examples of com.alibaba.jstorm.cluster.StormStatus

    // current status is inactive
    Map<StatusType, Callback> inactiveMap = new HashMap<StatusType, Callback>();

    inactiveMap.put(StatusType.monitor, new ReassignTransitionCallback(
        data, topologyid, new StormStatus(StatusType.inactive)));
    inactiveMap.put(StatusType.inactivate, null);
    inactiveMap.put(StatusType.startup, null);
    inactiveMap.put(StatusType.activate, new ActiveTransitionCallback());
    inactiveMap.put(StatusType.kill, new KillTransitionCallback(data,
        topologyid));
    inactiveMap.put(StatusType.remove, null);
    inactiveMap.put(StatusType.rebalance, new RebalanceTransitionCallback(
        data, topologyid, currentStatus));
    inactiveMap.put(StatusType.do_rebalance, null);

    rtn.put(StatusType.inactive, inactiveMap);

    // current status is killed
    Map<StatusType, Callback> killedMap = new HashMap<StatusType, Callback>();

    killedMap.put(StatusType.monitor, null);
    killedMap.put(StatusType.inactivate, null);
    killedMap.put(StatusType.startup, new KillTransitionCallback(data,
        topologyid));
    killedMap.put(StatusType.activate, null);
    killedMap.put(StatusType.kill, new KillTransitionCallback(data,
        topologyid));
    killedMap.put(StatusType.remove, new RemoveTransitionCallback(data,
        topologyid));
    killedMap.put(StatusType.rebalance, null);
    killedMap.put(StatusType.do_rebalance, null);
    rtn.put(StatusType.killed, killedMap);

    // current status is under rebalancing
    Map<StatusType, Callback> rebalancingMap = new HashMap<StatusType, Callback>();

    StatusType rebalanceOldStatus = StatusType.active;
    if (currentStatus.getOldStatus() != null) {
      rebalanceOldStatus = currentStatus.getOldStatus().getStatusType();
      // fix double rebalance, make the status always as rebalacing
      if (rebalanceOldStatus == StatusType.rebalance) {
        rebalanceOldStatus = StatusType.active;
      }
    }

    rebalancingMap.put(StatusType.monitor, null);
    rebalancingMap.put(StatusType.inactivate, null);
    rebalancingMap.put(StatusType.startup, new RebalanceTransitionCallback(
        data, topologyid, new StormStatus(rebalanceOldStatus)));
    rebalancingMap.put(StatusType.activate, null);
    rebalancingMap.put(StatusType.kill, null);
    rebalancingMap.put(StatusType.remove, null);
    rebalancingMap
        .put(StatusType.rebalance, new RebalanceTransitionCallback(
            data, topologyid, currentStatus));
    rebalancingMap.put(StatusType.do_rebalance,
        new DoRebalanceTransitionCallback(data, topologyid,
            new StormStatus(rebalanceOldStatus)));
    rtn.put(StatusType.rebalancing, rebalancingMap);

    /**
     * @@@ just handling 4 kind of status, maybe add later
     */
 
View Full Code Here

Examples of com.alibaba.jstorm.cluster.StormStatus

    String topologyId = event.getTopologyId();
    String topologyName = event.getTopologyName();
    String group = event.getGroup();

    StormStatus status = new StormStatus(StatusType.active);
    if (event.getOldStatus() != null) {
      status = event.getOldStatus();
    }

    StormBase stormBase = stormClusterState.storm_base(topologyId, null);
View Full Code Here

Examples of com.alibaba.jstorm.cluster.StormStatus

public class ActiveTransitionCallback extends BaseCallback {

  @Override
  public <T> Object execute(T... args) {

    return new StormStatus(StatusType.active);
  }
View Full Code Here

Examples of com.alibaba.jstorm.cluster.StormStatus

    data.getScheduExec().schedule(
        new DelayEventRunnable(data, topologyid, nextAction),
        delaySecs, TimeUnit.SECONDS);

    return new StormStatus(delaySecs, newType);
  }
View Full Code Here

Examples of com.alibaba.jstorm.cluster.StormStatus

public class InactiveTransitionCallback extends BaseCallback {

  @Override
  public <T> Object execute(T... args) {

    return new StormStatus(StatusType.inactive);
  }
View Full Code Here

Examples of com.alipay.bluewhale.core.cluster.StormStatus

        system_events.add(StatusType.startup.getStatus());
        system_events.add(StatusType.monitor.getStatus());
      }
      //��ȡָ��topology��Ӧ��״̬����
      StormBase stormbase = data.getStormClusterState().storm_base(topologyid, null);
      StormStatus topologyStatus=null;
      if (stormbase != null){
          topologyStatus = stormbase.getStatus();
      }
      if (topologyStatus != null) {
       
        //if(rtn==null){
          //����ÿ�λ�ȡ����״̬ת������
          rtn=stateTransitions(data,topologyid, topologyStatus);
        //}
        //��ȡ��ǰtopology״̬��ת����״̬����
        Map<StatusType, Callback> transition_map=rtn.get(topologyStatus.getStatusType());
       
        if(transition_map.containsKey(transition_status)){
          //��ȡת���¶���ִ�з�����ִ�С�
          Callback callback=transition_map.get(transition_status);
          //�����µ�״̬����StormStatus
          if(callback!=null){
            Object obj=callback.execute(args);
            if (obj != null && obj instanceof StormStatus) {
              StormStatus newStatus=(StormStatus)obj;
              //����״̬
                data.getStormClusterState().update_storm(topologyid, newStatus);
              LOG.info("Updated " + topologyid + " with status " + newStatus);
           
          }
View Full Code Here

Examples of com.alipay.bluewhale.core.cluster.StormStatus

   * @param stormId
   */
  public void startTopology(String topologyName,
      StormClusterState stormClusterState, String stormId) {
    LOG.info("Activating " + topologyName + ": " + stormId);
    StormStatus status = new StormStatus(StatusType.active);
    StormBase stormBase = new StormBase(topologyName,
        TimeUtils.current_time_secs(), status);
    stormClusterState.activate_storm(stormId, stormBase);
  }
View Full Code Here

Examples of com.alipay.bluewhale.core.cluster.StormStatus

public class ActiveTransitionCallback extends BaseCallback {

  @Override
  public <T> Object execute(T... args) {
   
    return new StormStatus(StatusType.active);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.