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