use of com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO in project Sentinel by alibaba.
the class ClusterAssignServiceImpl method unbindClusterServers.
@Override
public ClusterAppAssignResultVO unbindClusterServers(String app, Set<String> machineIdSet) {
AssertUtil.assertNotBlank(app, "app cannot be blank");
AssertUtil.isTrue(machineIdSet != null && !machineIdSet.isEmpty(), "machineIdSet cannot be empty");
ClusterAppAssignResultVO result = new ClusterAppAssignResultVO().setFailedClientSet(new HashSet<>()).setFailedServerSet(new HashSet<>());
for (String machineId : machineIdSet) {
ClusterAppAssignResultVO resultVO = unbindClusterServer(app, machineId);
result.getFailedClientSet().addAll(resultVO.getFailedClientSet());
result.getFailedServerSet().addAll(resultVO.getFailedServerSet());
}
return result;
}
use of com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO in project spring-boot-student by wyh-spring-ecosystem-student.
the class ClusterAssignServiceImpl method unbindClusterServer.
@Override
public ClusterAppAssignResultVO unbindClusterServer(String app, String machineId) {
AssertUtil.assertNotBlank(app, "app cannot be blank");
AssertUtil.assertNotBlank(machineId, "machineId cannot be blank");
if (isMachineInApp(machineId)) {
return handleUnbindClusterServerNotInApp(app, machineId);
}
Set<String> failedSet = new HashSet<>();
try {
ClusterGroupEntity entity = clusterConfigService.getClusterUniversalStateForAppMachine(app, machineId).get(10, TimeUnit.SECONDS);
Set<String> toModifySet = new HashSet<>();
toModifySet.add(machineId);
if (entity.getClientSet() != null) {
toModifySet.addAll(entity.getClientSet());
}
// Modify mode to NOT-STARTED for all chosen token servers and associated token clients.
modifyToNonStarted(toModifySet, failedSet);
} catch (Exception ex) {
Throwable e = ex instanceof ExecutionException ? ex.getCause() : ex;
LOGGER.error("Failed to unbind machine <{}>", machineId, e);
failedSet.add(machineId);
}
return new ClusterAppAssignResultVO().setFailedClientSet(failedSet).setFailedServerSet(new HashSet<>());
}
use of com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO in project XHuiCloud by sindaZeng.
the class ClusterAssignServiceImpl method unbindClusterServers.
@Override
public ClusterAppAssignResultVO unbindClusterServers(String app, Set<String> machineIdSet) {
AssertUtil.assertNotBlank(app, "app cannot be blank");
AssertUtil.isTrue(machineIdSet != null && !machineIdSet.isEmpty(), "machineIdSet cannot be empty");
ClusterAppAssignResultVO result = new ClusterAppAssignResultVO().setFailedClientSet(new HashSet<>()).setFailedServerSet(new HashSet<>());
for (String machineId : machineIdSet) {
ClusterAppAssignResultVO resultVO = unbindClusterServer(app, machineId);
result.getFailedClientSet().addAll(resultVO.getFailedClientSet());
result.getFailedServerSet().addAll(resultVO.getFailedServerSet());
}
return result;
}
use of com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO in project Sentinel by alibaba.
the class ClusterAssignServiceImpl method unbindClusterServer.
@Override
public ClusterAppAssignResultVO unbindClusterServer(String app, String machineId) {
AssertUtil.assertNotBlank(app, "app cannot be blank");
AssertUtil.assertNotBlank(machineId, "machineId cannot be blank");
if (isMachineInApp(machineId)) {
return handleUnbindClusterServerNotInApp(app, machineId);
}
Set<String> failedSet = new HashSet<>();
try {
ClusterGroupEntity entity = clusterConfigService.getClusterUniversalStateForAppMachine(app, machineId).get(10, TimeUnit.SECONDS);
Set<String> toModifySet = new HashSet<>();
toModifySet.add(machineId);
if (entity.getClientSet() != null) {
toModifySet.addAll(entity.getClientSet());
}
// Modify mode to NOT-STARTED for all chosen token servers and associated token clients.
modifyToNonStarted(toModifySet, failedSet);
} catch (Exception ex) {
Throwable e = ex instanceof ExecutionException ? ex.getCause() : ex;
LOGGER.error("Failed to unbind machine <{}>", machineId, e);
failedSet.add(machineId);
}
return new ClusterAppAssignResultVO().setFailedClientSet(failedSet).setFailedServerSet(new HashSet<>());
}
use of com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO in project pig by pig-mesh.
the class ClusterAssignServiceImpl method unbindClusterServers.
@Override
public ClusterAppAssignResultVO unbindClusterServers(String app, Set<String> machineIdSet) {
AssertUtil.assertNotBlank(app, "app cannot be blank");
AssertUtil.isTrue(machineIdSet != null && !machineIdSet.isEmpty(), "machineIdSet cannot be empty");
ClusterAppAssignResultVO result = new ClusterAppAssignResultVO().setFailedClientSet(new HashSet<>()).setFailedServerSet(new HashSet<>());
for (String machineId : machineIdSet) {
ClusterAppAssignResultVO resultVO = unbindClusterServer(app, machineId);
result.getFailedClientSet().addAll(resultVO.getFailedClientSet());
result.getFailedServerSet().addAll(resultVO.getFailedServerSet());
}
return result;
}
Aggregations