public final class ExecutionService extends Object
It will execute the program with an associated I/O window, with stop and restart buttons. It will also obey various descriptor properties such as whether or not to show a progress bar.
All processes launched by this class are terminated on VM exit (if these are not finished or terminated earlier).
Note that once service is run for the first time, subsequents runs can be
invoked by the user (rerun button) if it is allowed to do so
Sample usage - executing ls command:
ExecutionDescriptor descriptor = new ExecutionDescriptor() .frontWindow(true).controllable(true); ExternalProcessBuilder processBuilder = new ExternalProcessBuilder("ls"); ExecutionService service = ExecutionService.newService(processBuilder, descriptor, "ls command"); Future<Integer> task = service.run();
|Modifier and Type||Method and Description|
Creates new execution service.
Runs the process described by this service.
@NonNull public static ExecutionService newService(@NonNull Callable<Process> processCreator, @NonNull ExecutionDescriptor descriptor, @NonNull String displayName)
processCreatorand will manage them.
processCreator- callable returning the process to wrap up
descriptor- descriptor describing the configuration of service
displayName- display name of this service
Futureis exit code of the process.
The output tabs are reused (if caller does not use the custom one,
ExecutionDescriptor.getInputOutput()) - the tab to reuse
(if any) is selected by having the same name and same buttons
(control and option). If there is no output tab to reuse new one
This method can be invoked multiple times returning the different and
Futures. On each call
newService(java.util.concurrent.Callable, org.netbeans.api.extexecution.ExecutionDescriptor, java.lang.String)
is invoked in order to create the process. If the process creation fails
(throwing an exception) returned
Future will throw
For details on execution control see
Futureis exit code of the process
Built on October 1 2022. | Copyright © 2017-2022 Apache Software Foundation. All Rights Reserved.