use of com.tencent.polaris.circuitbreak.client.task.InstancesCircuitBreakTask in project polaris-java by polarismesh.
the class ServiceCallResultChecker method onServiceCallResult.
@Override
public void onServiceCallResult(InstanceGauge result) {
if (null == priorityTaskScheduler) {
return;
}
if (CollectionUtils.isEmpty(extensions.getCircuitBreakers())) {
return;
}
InstancesCircuitBreakTask rtTask = null;
for (CircuitBreaker circuitBreaker : extensions.getCircuitBreakers()) {
String cbName = circuitBreaker.getName();
boolean rtLimit = circuitBreaker.stat(result);
String instId = result.getInstanceId();
if (rtLimit && StringUtils.isNotEmpty(instId)) {
ServiceKey svcKey = new ServiceKey(result.getNamespace(), result.getService());
rtTask = new InstancesCircuitBreakTask(svcKey, cbName, null, instId, extensions, InstancesCircuitBreakTask.TaskPriority.HIGH);
break;
}
}
if (null == rtTask) {
return;
}
priorityTaskScheduler.addCircuitBreakTask(rtTask);
}
Aggregations