예제 #1
0
 private void process(final Socket socket) {
   try (BufferedReader reader =
           new BufferedReader(new InputStreamReader(socket.getInputStream()));
       BufferedWriter writer =
           new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
       Socket autoCloseSocket = socket) {
     String cmdLine = reader.readLine();
     if (null != cmdLine && DUMP_COMMAND.equalsIgnoreCase(cmdLine)) {
       List<String> result = new ArrayList<>();
       dumpDirectly("/" + jobName, result);
       outputMessage(
           writer, Joiner.on("\n").join(SensitiveInfoUtils.filterSensitiveIps(result)) + "\n");
     }
   } catch (final IOException ex) {
     log.warn(ex.getMessage());
   }
 }
예제 #2
0
 private void dumpDirectly(final String path, final List<String> result) {
   for (String each : coordinatorRegistryCenter.getChildrenKeys(path)) {
     String zkPath = path + "/" + each;
     String zkValue = coordinatorRegistryCenter.get(zkPath);
     if (null == zkValue) {
       zkValue = "";
     }
     TreeCache treeCache = (TreeCache) coordinatorRegistryCenter.getRawCache("/" + jobName);
     ChildData treeCacheData = treeCache.getCurrentData(zkPath);
     String treeCachePath = null == treeCacheData ? "" : treeCacheData.getPath();
     String treeCacheValue = null == treeCacheData ? "" : new String(treeCacheData.getData());
     if (zkValue.equals(treeCacheValue) && zkPath.equals(treeCachePath)) {
       result.add(Joiner.on(" | ").join(zkPath, zkValue));
     } else {
       result.add(Joiner.on(" | ").join(zkPath, zkValue, treeCachePath, treeCacheValue));
     }
     dumpDirectly(zkPath, result);
   }
 }