osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] commons-exec pull request #2: add jvmLaunchers


GitHub user harbby opened a pull request:

    https://github.com/apache/commons-exec/pull/2

    add jvmLaunchers

    When you need to perform some operations through a child process, it is very cumbersome and requires a lot of coding. I have an api below to simplify this process and make it elegant
    
    Like this: The Callable event is executed by the child process (jvm)
    ```
            JVMLauncher<Integer> launcher = JVMLaunchers.<Integer>newJvm()
                    .setCallable(() -> {
                        System.out.println("************ Compile start ***************");
                        TimeUnit.SECONDS.sleep(1);
                        System.out.println("************ Compile stop ***************");
                        return 1;
                    })
                    .setXms("16m")
                    .setXmx("16m")
                    .addUserjars(Collections.emptyList())
                    .setConsole((msg) -> System.err.println(msg))
                    .build();
    
            VmFuture<Integer> out = launcher.startAndGet();
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/harbby/commons-exec trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-exec/pull/2.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2
    
----
commit 057d8d99d966595424ebd48fd718d4ac24c95e5c
Author: ideal <yezhixinghai@...>
Date:   2018-11-19T05:59:10Z

    add jvmLaunchers

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: dev-help@xxxxxxxxxxxxxxxxxx