All Downloads are FREE. Search and download functionalities are using the official Maven repository.

enkan.system.repl.ReplBoot Maven / Gradle / Ivy

There is a newer version: 0.10.0
Show newest version
package enkan.system.repl;

import enkan.system.Repl;

import java.util.Arrays;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author kawasima
 */
public class ReplBoot {
    public static void start(Repl repl, SystemCommandRegister... registers) {
        try {
            ExecutorService service = Executors.newSingleThreadExecutor();
            if (registers != null) {
                Arrays.stream(registers).forEach(r -> r.register(repl));
            }
            service.execute(repl);
            service.shutdown();
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy