use of com.tencent.polaris.api.pojo.StatusDimension in project polaris-java-agent by polarismesh.
the class InstanceInvoker method stringToCircuitBreakers.
public static Map<StatusDimension, CircuitBreakerStatus> stringToCircuitBreakers(String value) {
Map<StatusDimension, CircuitBreakerStatus> values = new HashMap<>();
if (null == value || value.length() == 0) {
return values;
}
String[] tokens = value.split(SEP_CIRCUIT_BREAKER);
for (String token : tokens) {
String[] splits = token.split(SEP_CIRCUIT_BREAKER_VALUE);
if (splits.length != 2) {
continue;
}
StatusDimension dimension = new StatusDimension(splits[0], null);
CircuitBreakerStatus circuitBreakerStatus = new CircuitBreakerStatus("", Status.valueOf(splits[1]), 0);
values.put(dimension, circuitBreakerStatus);
}
return values;
}
use of com.tencent.polaris.api.pojo.StatusDimension in project polaris-java-agent by polarismesh.
the class InstanceInvoker method stringToCircuitBreakers.
public static Map<StatusDimension, CircuitBreakerStatus> stringToCircuitBreakers(String value) {
Map<StatusDimension, CircuitBreakerStatus> values = new HashMap<>();
if (null == value || value.length() == 0) {
return values;
}
String[] tokens = value.split(SEP_CIRCUIT_BREAKER);
for (String token : tokens) {
String[] splits = token.split(SEP_CIRCUIT_BREAKER_VALUE);
if (splits.length != 2) {
continue;
}
StatusDimension dimension = new StatusDimension(splits[0], null);
CircuitBreakerStatus circuitBreakerStatus = new CircuitBreakerStatus("", Status.valueOf(splits[1]), 0);
values.put(dimension, circuitBreakerStatus);
}
return values;
}
use of com.tencent.polaris.api.pojo.StatusDimension in project polaris-java-agent by polarismesh.
the class InstanceInvoker method circuitBreakersToString.
public static String circuitBreakersToString(Instance instance) {
List<String> values = new ArrayList<>();
Collection<StatusDimension> statusDimensions = instance.getStatusDimensions();
if (null != statusDimensions && statusDimensions.size() > 0) {
for (StatusDimension statusDimension : statusDimensions) {
CircuitBreakerStatus circuitBreakerStatus = instance.getCircuitBreakerStatus(statusDimension);
if (null != circuitBreakerStatus) {
values.add(statusDimension.getMethod() + SEP_CIRCUIT_BREAKER_VALUE + circuitBreakerStatus.getStatus().name());
}
}
}
if (values.isEmpty()) {
return "";
}
return String.join(SEP_CIRCUIT_BREAKER, values.toArray(new String[0]));
}
Aggregations