public final class ExecutionSystems extends Object
The first invocation of any method in this class triggers loading of the
default execution system provider, identified by the URI exec:///
. If
loading this provider fails for any reason, an unspecified error is thrown.
The first invocation of ExecutionSystemProvider.installedProviders()
from either newExecutionSystem
or
getExecutionSystem
triggers loading of all
installed providers. This loading process is described by
ExecutionSystemProvider
.
This class also defines a factory method that accepts a ClassLoader
,
enabling loading of providers from non-standard locations. The class loader
is only used if no suitable provider is found using the default methods.
Modifier and Type | Method and Description |
---|---|
static void |
closeAfterCompletion(ExecutionSystem es,
CommandExitLatch listener)
Blocks the registration of any new futures on the ExecutionSystemShutdownListener.
|
static void |
closeAfterCompletion(ExecutionSystem es,
CommandFuture commandFuture)
Closes any connections the ExecutionSystem uses to execute commands after the
CommandFuture finishes, even if other commands are still executing over the connections.
|
static ExecutionSystem |
getDefault()
Returns the default execution system for the local machine.
|
static ExecutionSystem |
getExecutionSystem(URI uri)
Gets an existing execution system with the specified URI.
|
static ExecutionSystem |
newExecutionSystem(URI uri,
Map<String,?> env)
Creates a new execution system for the specified URI.
|
static ExecutionSystem |
newExecutionSystem(URI uri,
Map<String,?> env,
ClassLoader loader)
Creates a new execution system for the specified URI.
|
public static ExecutionSystem getDefault()
public static ExecutionSystem getExecutionSystem(URI uri)
uri
- the URI of the desired systemExecutionSystemNotFoundException
- if there is no execution system
with the given URIpublic static ExecutionSystem newExecutionSystem(URI uri, Map<String,?> env) throws IOException
uri
- the URI of the desired systemenv
- a map of implementation-specific parameters required to create
the systemExecutionSystem
ExecutionSystemAlreadyExistsException
- if an execution system with
the specified URI already exists and the implementation forbids
duplicate systemsIOException
- is an I/O error occurs while creating and opening the
execution systempublic static ExecutionSystem newExecutionSystem(URI uri, Map<String,?> env, ClassLoader loader) throws IOException
uri
- the URI of the desired systemenv
- a map of implementation-specific parameters required to create
the systemloader
- the ClassLoader
to search for providers if no
matching one is found in the default class loaderExecutionSystem
ExecutionSystemAlreadyExistsException
- if an execution system with
the specified URI already exists and the implementation forbids
duplicate systemsIOException
- is an I/O error occurs while creating and opening the
execution systempublic static void closeAfterCompletion(ExecutionSystem es, CommandFuture commandFuture)
commandFuture
- the command future corresponding to an asynchronous commandpublic static void closeAfterCompletion(ExecutionSystem es, CommandExitLatch listener)