// Path: falchion-container/src/main/java/net/unit8/falchion/monitor/JvmMonitor.java
// public interface JvmMonitor {
//     void start(JvmProcess process);
//     MonitorStat getStat();
//     void stop();
// }
// 
// Path: falchion-container/src/main/java/net/unit8/falchion/monitor/MonitorStat.java
// public interface MonitorStat {
//     JsonObject toJson();
// }


import net.unit8.falchion.monitor.JvmMonitor;
import net.unit8.falchion.monitor.MonitorStat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
package net.unit8.falchion;



/**
 * @author kawasima
 */
public class JvmProcess implements Callable<JvmResult> {
    private static final Logger LOG = LoggerFactory.getLogger(JvmProcess.class);

    private static final DateTimeFormatter fmtIO = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");

    private final String id;
    private long pid = -1;
    private final String mainClass;
    private String classpath;
    private List<String> jvmOptions;

    private final ProcessBuilder processBuilder;
    private transient Process process;
    private long startedAt;
    private final CompletableFuture<Void> ready;

// Path: falchion-container/src/main/java/net/unit8/falchion/monitor/JvmMonitor.java
// public interface JvmMonitor {
//     void start(JvmProcess process);
//     MonitorStat getStat();
//     void stop();
// }
// 
// Path: falchion-container/src/main/java/net/unit8/falchion/monitor/MonitorStat.java
// public interface MonitorStat {
//     JsonObject toJson();
// }


// Path: falchion-container/src/main/java/net/unit8/falchion/JvmProcess.java
import net.unit8.falchion.monitor.JvmMonitor;
import net.unit8.falchion.monitor.MonitorStat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

package net.unit8.falchion;



/**
 * @author kawasima
 */
public class JvmProcess implements Callable<JvmResult> {
    private static final Logger LOG = LoggerFactory.getLogger(JvmProcess.class);

    private static final DateTimeFormatter fmtIO = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");

    private final String id;
    private long pid = -1;
    private final String mainClass;
    private String classpath;
    private List<String> jvmOptions;

    private final ProcessBuilder processBuilder;
    private transient Process process;
    private long startedAt;
    private final CompletableFuture<Void> ready;

    private final Set<JvmMonitor> monitors;