예제 #1
0
 protected boolean isDefault(MonitorEngine engine) {
   // 判断引擎的名称,这个是由管理员自行设置的
   if (engine.isDefault()) return true;
   // 在某些本机场景下, server address = localhost, engine address = 192.168.12.63
   SocketAddress serverAddr = IpUtils.parseSocketAddress(serverService.getServer().getAddress());
   SocketAddress engineAddr = IpUtils.parseSocketAddress(engine.getAddress());
   return StringUtils.equals(serverAddr.getHost(), engineAddr.getHost());
 }
 // 当引擎被批准时,其路径也应该随着用户设定的新路径发生了变化,修改之
 // Topo节点也会自动随之而修改
 void autoUpdateNodesForEngine(String legacyPath, String path) {
   if (StringUtils.isNotBlank(path) && !StringUtils.equals(legacyPath, path)) {
     try {
       nodeService.updateNodesPath(legacyPath, path);
     } catch (NodeException e) {
       logger.warn(e.getMessage(), e);
     }
   }
 }
예제 #3
0
 @Override
 protected void validateOnUpdate(MonitorEngine exist, MonitorEngine resource)
     throws ValidationException {
   super.validateOnUpdate(exist, resource);
   // IP地址变了
   if (!StringUtils.equals(exist.getAddress(), resource.getAddress())) {
     MonitorEngine another = findByAddress(resource.getAddress());
     if (another != null) {
       throw new ValidationException(
           "There is another engine with address " + resource.getAddress());
     }
   }
 }