Out Process

A java library to run pieces of code in another JVM.

Лицензия

Лицензия

Группа

Группа

com.github.dyorgio.runtime
Идентификатор

Идентификатор

out-process
Последняя версия

Последняя версия

1.2.7
Дата

Дата

Тип

Тип

jar
Описание

Описание

Out Process
A java library to run pieces of code in another JVM.
Ссылка на сайт

Ссылка на сайт

https://github.com/dyorgio/out-process
Система контроля версий

Система контроля версий

https://github.com/dyorgio/out-process.git

Скачать out-process

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.dyorgio.runtime/out-process/ -->
<dependency>
    <groupId>com.github.dyorgio.runtime</groupId>
    <artifactId>out-process</artifactId>
    <version>1.2.7</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.dyorgio.runtime/out-process/
implementation 'com.github.dyorgio.runtime:out-process:1.2.7'
// https://jarcasting.com/artifacts/com.github.dyorgio.runtime/out-process/
implementation ("com.github.dyorgio.runtime:out-process:1.2.7")
'com.github.dyorgio.runtime:out-process:jar:1.2.7'
<dependency org="com.github.dyorgio.runtime" name="out-process" rev="1.2.7">
  <artifact name="out-process" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.dyorgio.runtime', module='out-process', version='1.2.7')
)
libraryDependencies += "com.github.dyorgio.runtime" % "out-process" % "1.2.7"
[com.github.dyorgio.runtime/out-process "1.2.7"]

Зависимости

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13

Модули Проекта

Данный проект не имеет модулей.

Out Process

Build Status Maven Central

A java library to run pieces of code in another (new) JVM.

Why use it?

  • Limit code execution memory (-Xmx??).
  • Safe native code execution (Main JVM not killed by DLL/SO/DYLIB invalid address error).
  • Prevent external code to manipulate your objects.
  • Run limited one-per-jvm code (singleton) in parallel.
  • In use with external binaries can limit cpu usage too.

Usage

For single sync execution:

// Specify JVM options (optional)
OneRunOutProcess oneRun = new OneRunOutProcess("-Xmx32m");
// Run in JVM 1 and exit
int returnCode = oneRun.run(() -> System.out.println("Hello 1"));
// Call in JVM 2 and exit
System.out.println(oneRun.call(() -> System.getProperty("java.version")).getResult());

For consecutive/async executions:

// Specify JVM options (optional)
OutProcessExecutorService sharedProcess = new OutProcessExecutorService("-Xmx32m");
// Submit a task to run in external JVM
sharedProcess.submit(new CallableSerializable<String>() {
    @Override
    public String call() {
        return System.setProperty("SHARED_DATA", "EXECUTED");
    }
});
// Get shared data in external JVM and wait (.get())
String value = sharedProcess.submit(new CallableSerializable<String>() {
    @Override
    public String call() {
        return System.getProperty("SHARED_DATA");
    }
}).get();
System.out.println(value);

Maven

<dependency>
    <groupId>com.github.dyorgio.runtime</groupId>
    <artifactId>out-process</artifactId>
    <version>1.2.7</version>
</dependency>

Версии библиотеки

Версия
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.0
1.0.1
1.0.0