Package com.alipay.bluewhale.core.callback.impl

Source Code of com.alipay.bluewhale.core.callback.impl.DelayRebalanceTransitionCallback

package com.alipay.bluewhale.core.callback.impl;

import java.util.concurrent.TimeUnit;

import org.apache.log4j.Logger;

import com.alipay.bluewhale.core.callback.BaseCallback;
import com.alipay.bluewhale.core.cluster.StormStatus;
import com.alipay.bluewhale.core.daemon.NimbusData;
import com.alipay.bluewhale.core.daemon.StatusType;
import com.alipay.bluewhale.core.schedule.DelayEventRunnable;

/**
* �ӳ� oldStatus.getDelaySecs()���ִ�е�ǰ״̬��StatusTransition.transition do_rebalance����
*
*/
public class DelayRebalanceTransitionCallback extends BaseCallback {

  private static Logger LOG = Logger.getLogger(DelayRebalanceTransitionCallback.class);
 
  private NimbusData data;
  private String topologyid;
  private StormStatus oldStatus;
 
  public DelayRebalanceTransitionCallback(NimbusData data, String topologyid,
      StormStatus status) {
    this.data=data;
    this.topologyid=topologyid;
    this.oldStatus=status;
  }

  @Override
  public <T> Object execute(T... args) {
   
        LOG.info("Delaying event " + oldStatus.getStatusType().getStatus() + " for " + oldStatus.getDelaySecs() + " secs for " + topologyid);
   
    data.getScheduExec().schedule(new DelayEventRunnable(data,topologyid,StatusType.do_rebalance), oldStatus.getDelaySecs(), TimeUnit.SECONDS);

    return null;
  }

}
TOP

Related Classes of com.alipay.bluewhale.core.callback.impl.DelayRebalanceTransitionCallback

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.