Package com.taobao.zeus.store

Examples of com.taobao.zeus.store.GroupBean


  private MasterContext context;
  private static Logger log = LoggerFactory.getLogger(Master.class);

  public Master(final MasterContext context) {
    this.context = context;
    GroupBean root = context.getGroupManager().getGlobeGroupBean();

    if (Environment.isPrePub()) {
      // 如果是预发环境,添加stop listener,阻止自动调度执行
      context.getDispatcher().addDispatcherListener(
          new StopScheduleJobListener());
    }
    context.getDispatcher().addDispatcherListener(
        new AddJobListener(context, this));
    context.getDispatcher().addDispatcherListener(
        new JobFailListener(context));
    context.getDispatcher().addDispatcherListener(
        new DebugListener(context));
    context.getDispatcher().addDispatcherListener(
        new JobSuccessListener(context));
    Map<String, JobBean> allJobBeans = root.getAllSubJobBeans();
    for (String id : allJobBeans.keySet()) {
      context.getDispatcher().addController(
          new JobController(context, this, id));
    }
View Full Code Here


      if(group instanceof ReadOnlyGroupDescriptor){
        readGd=(ReadOnlyGroupDescriptor) group;
      }else{
        readGd=new ReadOnlyGroupDescriptor(group);
      }
      GroupBean result=new GroupBean(readGd);
      return getDownstreamGroupBean(result);
    }
View Full Code Here

              if(child instanceof ReadOnlyGroupDescriptor){
                readGd=(ReadOnlyGroupDescriptor) child;
              }else{
                readGd=new ReadOnlyGroupDescriptor(child);
              }
              GroupBean childBean=new GroupBean(readGd);
              if(pool.getActiveCount()<15) {
                futures.add(getDownstreamGroupBean(childBean, 99));
              }else{
                getDownstreamGroupBean(childBean, 0);
              }
              childBean.setParentGroupBean(parent);
              parent.getChildrenGroupBeans().add(childBean);
            }
            for(Future<GroupBean> f:futures){
              f.get(2000,TimeUnit.MILLISECONDS);
            }
View Full Code Here

        throw new ZeusException("cronExpression表达式格式出错");
      }
    }
   
    //检查依赖的死循环问题
    GroupBean root=readOnlyGroupManager.getGlobeGroupBean();
    Map<String, JobBean> allJobBeans=root.getAllSubJobBeans();
    Set<JobBean> deps=new HashSet<JobBean>();
    if(job.getScheduleType()==JobScheduleType.Dependent){
      for(String jobId:job.getDependencies()){
        if(allJobBeans.get(jobId)==null){
          throw new ZeusException("依赖任务:"+jobId+" 不存在");
View Full Code Here

  public List<String> findActualJobFollowers(String jobId) {
    List<ZeusFollow> jobFollows=findJobFollowers(jobId);
    JobBean jobBean=groupManager.getUpstreamJobBean(jobId);
   
    List<String> groupIds=new ArrayList<String>();
    GroupBean gb=jobBean.getGroupBean();
    while(gb!=null){
      groupIds.add(gb.getGroupDescriptor().getId());
      gb=gb.getParentGroupBean();
    }
    List<ZeusFollow> groupFollows=findGroupFollowers(groupIds);
   
    List<String> follows=new ArrayList<String>();
    //任务创建人自动纳入消息通知人员名单
View Full Code Here

import com.taobao.zeus.util.Tuple;
@SuppressWarnings("unchecked")
public class MysqlGroupManager extends HibernateDaoSupport implements GroupManager{
  @Override
  public void deleteGroup(String user, String groupId) throws ZeusException {
    GroupBean group=getDownstreamGroupBean(groupId);
    if(group.isDirectory()){
      if(!group.getChildrenGroupBeans().isEmpty()){
        throw new ZeusException("该组下不为空,无法删除");
      }
    }else{
      if(!group.getJobBeans().isEmpty()){
        throw new ZeusException("该组下不为空,无法删除");
      }
    }
    getHibernateTemplate().delete(getHibernateTemplate().get(GroupPersistence.class, Integer.valueOf(groupId)));
  }
View Full Code Here

    getHibernateTemplate().delete(getHibernateTemplate().get(GroupPersistence.class, Integer.valueOf(groupId)));
  }

  @Override
  public void deleteJob(String user, String jobId) throws ZeusException {
    GroupBean root= getGlobeGroupBean();
    JobBean job=root.getAllSubJobBeans().get(jobId);
    if(!job.getDepender().isEmpty()){
      List<String> deps=new ArrayList<String>();
      for(JobBean jb:job.getDepender()){
        deps.add(jb.getJobDescriptor().getId());
      }
View Full Code Here


  @Override
  public GroupBean getDownstreamGroupBean(String groupId) {
    GroupDescriptor group=getGroupDescriptor(groupId);
    GroupBean result=new GroupBean(group);
    return getDownstreamGroupBean(result);
  }
View Full Code Here

  @Override
  public GroupBean getDownstreamGroupBean(GroupBean parent) {
    if(parent.isDirectory()){
      List<GroupDescriptor> children=getChildrenGroup(parent.getGroupDescriptor().getId());
      for(GroupDescriptor child:children){
        GroupBean childBean=new GroupBean(child);
        getDownstreamGroupBean(childBean);
        childBean.setParentGroupBean(parent);
        parent.getChildrenGroupBeans().add(childBean);
      }
    }else{
      List<Tuple<JobDescriptor, JobStatus>> jobs=getChildrenJob(parent.getGroupDescriptor().getId());
      for(Tuple<JobDescriptor, JobStatus> tuple:jobs){
View Full Code Here

  }

  @Override
  public GroupBean getDownstreamGroupBean(String groupId) {
    GroupDescriptor group=getGroupDescriptor(groupId);
    GroupBean result=new GroupBean(group);
    return getDownstreamGroupBean(result);
  }
View Full Code Here

TOP

Related Classes of com.taobao.zeus.store.GroupBean

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.