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

com.alibaba.schedulerx.worker.route.RouterManager Maven / Gradle / Ivy

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

import com.alibaba.schedulerx.common.util.IdUtil;
import com.google.common.collect.Maps;

import java.util.Map;

/**
 * @author dingxuan
 */
public enum RouterManager {
    INSTANCE;

    public Map groupRouterMap = Maps.newConcurrentMap();

    public Router getRouter(long appGroupId, long jobId) {
        String key = IdUtil.getRouteStrategyUniqueId(appGroupId, jobId);
        if (groupRouterMap.containsKey(key)) {
            return groupRouterMap.get(key);
        } else {
            return null;
        }
    }

    public void updateRouter(long appGroupId, long jobId, Router router) {
        String key = IdUtil.getRouteStrategyUniqueId(appGroupId, jobId);
        groupRouterMap.put(key, router);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy