NacosSyncToZookeeperServiceImpl implements SyncService { @Override public boolean delete(TaskDO taskDO) { try { NamingService sourceNamingService = nacosServerHolder.get(taskDO.getSourceClusterId(), taskDO.getGroupName()); EventListener eventListener = nacosListenerMap.remove(taskDO.getTaskId()); PathChildrenCache pathChildrenCache = pathChildrenCacheMap.get(taskDO.getTaskId()); sourceNamingService.unsubscribe(taskDO.getServiceName(), eventListener); CloseableUtils.closeQuietly(pathChildrenCache); Set<String> instanceUrlSet = instanceBackupMap.get(taskDO.getTaskId()); CuratorFramework client = zookeeperServerHolder.get(taskDO.getDestClusterId(), taskDO.getGroupName()); for (String instanceUrl : instanceUrlSet) { client.delete().quietly().forPath(instanceUrl); } } catch (Exception e) { log.error("delete task from nacos to zk was failed, taskId:{}", taskDO.getTaskId(), e); metricsManager.recordError(MetricsStatisticsType.DELETE_ERROR); return false; } return true; } @Autowired  NacosSyncToZookeeperServiceImpl(SkyWalkerCacheServices skyWalkerCacheServices,
        NacosServerHolder nacosServerHolder, ZookeeperServerHolder zookeeperServerHolder); @Override boolean delete(TaskDO taskDO); @Override boolean sync(TaskDO taskDO);  }
@Test(expected = Exception.class) public void testNacosDeleteToZookeeperWithException() throws Exception { Assert.assertFalse(nacosSyncToZookeeperService.delete(null)); }