|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.gitee.sop.gatewaycommon.manager; |
|
|
|
package com.gitee.sop.gatewaycommon.manager; |
|
|
|
|
|
|
|
|
|
|
|
import com.gitee.sop.gatewaycommon.bean.RouteConfig; |
|
|
|
import com.gitee.sop.gatewaycommon.bean.RouteConfig; |
|
|
|
|
|
|
|
import com.gitee.sop.gatewaycommon.bean.RouteStatus; |
|
|
|
import com.gitee.sop.gatewaycommon.util.MyBeanUtil; |
|
|
|
import com.gitee.sop.gatewaycommon.util.MyBeanUtil; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
@ -15,10 +16,11 @@ public class DefaultRouteConfigManager implements RouteConfigManager { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected static Map<String, RouteConfig> routeConfigMap = new ConcurrentHashMap<>(64); |
|
|
|
protected static Map<String, RouteConfig> routeConfigMap = new ConcurrentHashMap<>(64); |
|
|
|
|
|
|
|
|
|
|
|
private static RouteConfig DEFAULT_CONFIG; |
|
|
|
private static final RouteConfig DEFAULT_ROUTE_CONFIG; |
|
|
|
|
|
|
|
|
|
|
|
public DefaultRouteConfigManager() { |
|
|
|
static { |
|
|
|
DEFAULT_CONFIG = this.newRouteConfig(); |
|
|
|
DEFAULT_ROUTE_CONFIG = new RouteConfig(); |
|
|
|
|
|
|
|
DEFAULT_ROUTE_CONFIG.setStatus(RouteStatus.ENABLE.getStatus()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -47,6 +49,6 @@ public class DefaultRouteConfigManager implements RouteConfigManager { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public RouteConfig get(String routeId) { |
|
|
|
public RouteConfig get(String routeId) { |
|
|
|
return routeConfigMap.getOrDefault(routeId, DEFAULT_CONFIG); |
|
|
|
return routeConfigMap.getOrDefault(routeId, DEFAULT_ROUTE_CONFIG); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|