The API supporting execution of an external process.
The support API for processing the growing streams or files.
The support SPI for creation of external processes.
This API origins in External Execution API and contains set of basic features with minimal dependencies. For the better integration with the IDE check also original External Execution API.
To see the simplest usage of this API to handle external process see documentation of BaseExecutionService
The External Execution Base module provides the ExternalExecutionBaseAPI that contains support for execution of external processes. There is also abstraction of process builder and support class for extended process handling.
Another exported API ExternalExecutionBaseInputAPI define interfaces for input processing (character or line based) and provides common implementations of these with factory methods.
The SPI ExternalExecutionBaseSPI allows different implementations of process builder and defined interface for extended process handling support.
Document that ProcessesImplementation may throw an UnsupportedOperationException when it is not able to kill the process tree.
First initial release of the External Execution Base API. Refactored from External Execution API.
Client needs to execute an external process and handle process streams.
In order to achieve this client creates the BaseExecutionDescriptor. Via this object client configures all the client integration parameters of the execution. As a next step client creates the BaseExecutionService itself and calls run to execute the job. Run can be called multiple times. The output and input streams are handled by the service. Additional processing can be configured in descriptor through interfaces described in following usecases.
The creation of the external process is supported by ProcessBuilder to make things easier.
Client needs to process character data coming from stream, file or other source.
To abstract the source of the data client must implement InputReader. To abstract the data processing client must implement InputProcessor or LineProcessor. For all three interfaces there are prepared common implementations (and bridge from character based to line based processing) at these three factory classes:
Once the data source and processing objects are prepared client creates InputReaderTask. Factory methods of the InputReaderTask can create either common task exiting on interruption or cancellation or draining task which is trying to drain out all available data before exiting.
Third party wants to implement custom process builder to provide additional functionality, such as remote execution.
Client wants to destroy the process, trying to kill whole process tree. Method Processes.killTree(java.lang.Process process, Map<String,String> environment) is designed for that. It will use a ProcessesImplementation registered in default lookup to do so.
Read more about the implementation in the answers to architecture questions.