Class SimpleProcessExecutor
java.lang.Object
org.aksw.commons.io.process.util.SimpleProcessExecutor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected ProcessBuilderprotected UnaryOperator<Consumer<String>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute()io.reactivex.rxjava3.core.Single<Integer> voidexecuteReadLines(io.reactivex.rxjava3.core.Flowable<String> upstream, io.reactivex.rxjava3.core.FlowableEmitter<String> emitter) Return the underlying processBuilderbooleanvoidWraps process execution as a single that will hold the exit code.setOutputSink(Consumer<String> outputSink) setService(boolean isService) If the process is a service, its output will be processed by a separate thread.setSimilarityRemover(UnaryOperator<Consumer<String>> similarityRemover) intUtility function that blocks until the process the ends, thereby forwarding output to the configured sink and applying filtering of consecutive lines that are too similarstatic SimpleProcessExecutorwrap(ProcessBuilder processBuilder)
-
Field Details
-
processBuilder
-
outputSink
-
similarityRemover
-
isService
protected boolean isService
-
-
Constructor Details
-
SimpleProcessExecutor
-
-
Method Details
-
getOutputSink
-
setOutputSink
-
getSimilarityRemover
-
setSimilarityRemover
public SimpleProcessExecutor setSimilarityRemover(UnaryOperator<Consumer<String>> similarityRemover) -
isService
public boolean isService() -
getProcessBuilder
-
setService
If the process is a service, its output will be processed by a separate thread. Otherwise, all output will be consumed by the invoking thread.- Returns:
-
watchProcessOutput
Utility function that blocks until the process the ends, thereby forwarding output to the configured sink and applying filtering of consecutive lines that are too similar- Parameters:
p-- Returns:
- Throws:
IOExceptionInterruptedException
-
run
-
execute
- Throws:
IOExceptionInterruptedException
-
executeReadLines
public void executeReadLines(io.reactivex.rxjava3.core.Flowable<String> upstream, io.reactivex.rxjava3.core.FlowableEmitter<String> emitter) throws IOException - Throws:
IOException
-
executeFuture
public io.reactivex.rxjava3.core.Single<Integer> executeFuture() throws IOException, InterruptedException- Throws:
IOExceptionInterruptedException
-
executeCore
public Map.Entry<io.reactivex.rxjava3.core.Single<Integer>, Process> executeCore() throws IOException, InterruptedException- Throws:
IOExceptionInterruptedException
-
wrap
-