All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.schedulerx.worker.discovery.GroupManager Maven / Gradle / Ivy

There is a newer version: 1.12.2
Show newest version
package com.alibaba.schedulerx.worker.discovery;

import akka.actor.ActorSystem;
import com.alibaba.schedulerx.common.domain.AppGroupInfo;
import com.alibaba.schedulerx.common.domain.enums.AppVersion;
import com.alibaba.schedulerx.worker.SchedulerxWorker;
import com.alibaba.schedulerx.worker.log.LogFactory;
import com.alibaba.schedulerx.worker.log.Logger;
import com.alibaba.schedulerx.worker.util.ConsoleUtil;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public enum GroupManager {
    INSTANCE;
    
    private String namespace;
    private String namespaceSource;
    
    private Map groupId2AppGroupIdMap = Maps.newConcurrentMap();
    private Map parentGroupId2CountMap = Maps.newConcurrentMap();

    private Map groupId2ParentAppGroupMap = Maps.newConcurrentMap();

    private Map groupId2AppKeyMap = Maps.newConcurrentMap();
    
    private static final Logger LOGGER = LogFactory.getLogger(SchedulerxWorker.class);
    
    public void init(String namespace, String namespaceSource, List groupIds, List appKeys) {
        this.namespace = namespace;
        this.namespaceSource = namespaceSource;
        if (groupIds == null || appKeys == null || groupIds.size() == 0 || groupIds.size() != appKeys.size()) {
            throw new IllegalArgumentException("Invalid Config, GroupId:"+StringUtils.join(groupIds, ",")
                    +" AppKey:"+StringUtils.join(appKeys, ","));
        }
        for (int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy