|
org.netbeans.modules.extexecution/2 1.25.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.api.extexecution.ExecutionService
public final class ExecutionService
Execution service provides the facility to execute the process while displaying the output and handling the input.
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
(ExecutionDescriptor.isControllable()
).
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();
newService(java.util.concurrent.Callable, org.netbeans.api.extexecution.ExecutionDescriptor, java.lang.String)
,
ExecutionDescriptor
Method Summary | |
---|---|
static ExecutionService |
newService(Callable<Process> processCreator,
ExecutionDescriptor descriptor,
String displayName)
Creates new execution service. |
Future<Integer> |
run()
Runs the process described by this service. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
@NonNull public static ExecutionService newService(@NonNull Callable<Process> processCreator, @NonNull ExecutionDescriptor descriptor, @NonNull String displayName)
processCreator
and will manage them.
processCreator
- callable returning the process to wrap updescriptor
- descriptor describing the configuration of servicedisplayName
- display name of this service
@NonNull public Future<Integer> run()
Future
is exit code of the process.
The output tabs are reused (if caller does not use the custom one,
see 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
is opened.
This method can be invoked multiple times returning the different and
unrelated Future
s. On each call Callable<Process>
passed to 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
ExecutionException
on Future.get()
request.
For details on execution control see ExecutionDescriptor
.
Future
is exit code of the process
|
org.netbeans.modules.extexecution/2 1.25.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |