Skip to content

Commit

Permalink
pid 파일 쓰기 - ifsmoverRest와 연동하기 위함
Browse files Browse the repository at this point in the history
  • Loading branch information
HeoKyungseok committed May 18, 2022
1 parent a53cd33 commit 10bcdb4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/ifs_mover/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

package ifs_mover;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
Expand All @@ -25,6 +27,7 @@

public class Main {
private static final Logger logger = LoggerFactory.getLogger(Main.class);
private static final String JOBID_PATH = "./.jobId";
private static final int THREAD_COUNT = 5;

private static final long UNIT_G = (1024 * 1024 * 1024);
Expand Down Expand Up @@ -97,6 +100,7 @@ public static void main(String[] args) {
DBManager.createJobTable();
DBManager.createJob(pid, options.getType(), options.getSourceConfig(), options.getTargetConfig());
jobId = DBManager.getJobId(pid);
writeJobID(jobId);
DBManager.createMoveObjectTable(jobId);
DBManager.createMoveObjectTableIndex(jobId);

Expand Down Expand Up @@ -479,5 +483,21 @@ private static void status() {
System.out.println();
}
}

private static void writeJobID(String jobID) {
File file = new File(JOBID_PATH);
try {
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file);
fw.write(jobID);
fw.flush();
fw.close();
} catch (IOException e) {
logger.error(e.getMessage());
System.exit(-1);
}
}
}

0 comments on commit 10bcdb4

Please sign in to comment.