@Test public void assertgetPidFromFile2() { String[] files = ScriptPidUtils.getItemsPaths(executorName, jobName); assertThat(files.length).isEqualTo(2); Arrays.asList(files).contains(jobFilePath + ScriptPidUtils.FILESEPARATOR + "1"); Arrays.asList(files).contains(jobFilePath + ScriptPidUtils.FILESEPARATOR + "2"); }
public static String[] getItemsPaths(String executorName, String jobName) { String jobNamePath = String.format(EXECUTINGJOBPATH, executorName, jobName); File jobNameFile = new File(jobNamePath); if (!jobNameFile.exists() || jobNameFile.isFile()) { return new String[0]; } File[] files = jobNameFile.listFiles(); if (files == null || files.length == 0) { return new String[]{}; } String[] filePaths = new String[files.length]; int i = 0; for (File file : files) { filePaths[i++] = file.getAbsolutePath(); } return filePaths; }
ScriptPidUtils { public static String[] getItemsPaths(String executorName, String jobName) { String jobNamePath = String.format(EXECUTINGJOBPATH, executorName, jobName); File jobNameFile = new File(jobNamePath); if (!jobNameFile.exists() || jobNameFile.isFile()) { return new String[0]; } File[] files = jobNameFile.listFiles(); if (files == null || files.length == 0) { return new String[]{}; } String[] filePaths = new String[files.length]; int i = 0; for (File file : files) { filePaths[i++] = file.getAbsolutePath(); } return filePaths; } }
ScriptPidUtils { public static String[] getItemsPaths(String executorName, String jobName) { String jobNamePath = String.format(EXECUTINGJOBPATH, executorName, jobName); File jobNameFile = new File(jobNamePath); if (!jobNameFile.exists() || jobNameFile.isFile()) { return new String[0]; } File[] files = jobNameFile.listFiles(); if (files == null || files.length == 0) { return new String[]{}; } String[] filePaths = new String[files.length]; int i = 0; for (File file : files) { filePaths[i++] = file.getAbsolutePath(); } return filePaths; }  }
ScriptPidUtils { public static String[] getItemsPaths(String executorName, String jobName) { String jobNamePath = String.format(EXECUTINGJOBPATH, executorName, jobName); File jobNameFile = new File(jobNamePath); if (!jobNameFile.exists() || jobNameFile.isFile()) { return new String[0]; } File[] files = jobNameFile.listFiles(); if (files == null || files.length == 0) { return new String[]{}; } String[] filePaths = new String[files.length]; int i = 0; for (File file : files) { filePaths[i++] = file.getAbsolutePath(); } return filePaths; }  static File getSaturnExecutingHome(); static void writePidToFile(String executorName, String jobName, int jobItem, long pid); @Deprecated static long _getPidFromFile(String executorName, String jobName, String jobItem); static long getFirstPidFromFile(String executorName, String jobName, String jobItem); static List<Long> getPidsFromFile(String executorName, String jobName, String jobItem); static String[] getItemsPaths(String executorName, String jobName); static boolean removeAllPidFile(String executorName, String jobName, String jobItem); static boolean removePidFile(String executorName, String jobName, String jobItem, long pid); static boolean removeAllPidFile(String executorName, String jobName, int jobItem); static void killAllChildrenByPid(long pid, boolean force); static String exeWholeCmd(String cmd); static String exeCmdWithoutPipe(CommandLine cmdLine, ByteArrayInputStream input, Map<String, String> env); static void checkAllExistJobs(final CoordinatorRegistryCenter regCenter); static void forceStopRunningShellJob(final String executorName, final String jobName); static void checkOneExistJob(final CoordinatorRegistryCenter regCenter, final String jobName); static boolean isPidRunning(long pid); static boolean isPidRunning(String pid); static Map<String, String> parseString2Map(String source); static Map<String, String> loadEnv(); static String filterEnvInCmdStr(Map<String, String> env, String cmd); }
ScriptPidUtils { public static String[] getItemsPaths(String executorName, String jobName) { String jobNamePath = String.format(EXECUTINGJOBPATH, executorName, jobName); File jobNameFile = new File(jobNamePath); if (!jobNameFile.exists() || jobNameFile.isFile()) { return new String[0]; } File[] files = jobNameFile.listFiles(); if (files == null || files.length == 0) { return new String[]{}; } String[] filePaths = new String[files.length]; int i = 0; for (File file : files) { filePaths[i++] = file.getAbsolutePath(); } return filePaths; }  static File getSaturnExecutingHome(); static void writePidToFile(String executorName, String jobName, int jobItem, long pid); @Deprecated static long _getPidFromFile(String executorName, String jobName, String jobItem); static long getFirstPidFromFile(String executorName, String jobName, String jobItem); static List<Long> getPidsFromFile(String executorName, String jobName, String jobItem); static String[] getItemsPaths(String executorName, String jobName); static boolean removeAllPidFile(String executorName, String jobName, String jobItem); static boolean removePidFile(String executorName, String jobName, String jobItem, long pid); static boolean removeAllPidFile(String executorName, String jobName, int jobItem); static void killAllChildrenByPid(long pid, boolean force); static String exeWholeCmd(String cmd); static String exeCmdWithoutPipe(CommandLine cmdLine, ByteArrayInputStream input, Map<String, String> env); static void checkAllExistJobs(final CoordinatorRegistryCenter regCenter); static void forceStopRunningShellJob(final String executorName, final String jobName); static void checkOneExistJob(final CoordinatorRegistryCenter regCenter, final String jobName); static boolean isPidRunning(long pid); static boolean isPidRunning(String pid); static Map<String, String> parseString2Map(String source); static Map<String, String> loadEnv(); static String filterEnvInCmdStr(Map<String, String> env, String cmd); static final long UNKNOWN_PID; static final String EXECUTINGPATH; static final String OUTPUT_PATH; static final String EXECUTINGJOBPATH; static final String JOBITEMPIDSPATH; static final String JOBITEMPATH; static final String JOBITEMPIDPATH2; static final String JOBITEMOUTPUTPATH; }