ideal
2018-12-09 05:14:15 UTC
Hi all, the current use of java8 has been very extensive. I designed a
stream api based simplified `exec` and verified its usability in a lot of
scenarios. Share my api now.
demo:
JVMLauncher<Integer> launcher = JVMLaunchers.<Integer>newJvm()
.setCallable(() -> {
System.out.println("************ exec task jvm
start ***************");
TimeUnit.SECONDS.sleep(1);
System.out.println("************ exec task jvm
stop ***************");
return 1;
})
.setXms("16m")
.setXmx("16m")
.addUserjars(Collections.emptyList())
.setConsole((msg) -> System.err.println(msg))
.build();
VmFuture<Integer> out = launcher.startAndGet(); --run
stream api based simplified `exec` and verified its usability in a lot of
scenarios. Share my api now.
demo:
JVMLauncher<Integer> launcher = JVMLaunchers.<Integer>newJvm()
.setCallable(() -> {
System.out.println("************ exec task jvm
start ***************");
TimeUnit.SECONDS.sleep(1);
System.out.println("************ exec task jvm
stop ***************");
return 1;
})
.setXms("16m")
.setXmx("16m")
.addUserjars(Collections.emptyList())
.setConsole((msg) -> System.err.println(msg))
.build();
VmFuture<Integer> out = launcher.startAndGet(); --run