@InterfaceAudience.Public @InterfaceStability.Evolving public interface LaunchableService extends Service
The command line options will be passed down before the
Service.init(Configuration)
operation is invoked via an
invocation of bindArgs(Configuration, List)
After the service has been successfully started via Service.start()
the execute()
method is called to execute the
service. When this method returns, the service launcher will exit, using
the return code from the method as its exit option.
Modifier and Type | Method and Description |
---|---|
Configuration |
bindArgs(Configuration config,
List<String> args)
Propagate the command line arguments.
|
int |
execute()
Run a service.
|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, registerServiceListener, start, stop, unregisterServiceListener, waitForServiceToStop
Configuration bindArgs(Configuration config, List<String> args) throws Exception
This method is called before Service.init(Configuration)
;
Any non-null configuration that is returned from this operation
becomes the one that is passed on to that Service.init(Configuration)
operation.
This permits implementations to change the configuration before
the init operation. As the ServiceLauncher only creates
an instance of the base Configuration
class, it is
recommended to instantiate any subclass (such as YarnConfiguration)
that injects new resources.
config
- the initial configuration build up by the
service launcher.args
- list of arguments passed to the command line
after any launcher-specific commands have been stripped.Exception
- any problemint execute() throws Exception
Service.start()
.
The return value becomes the exit code of the launched process.
If an exception is raised, the policy is:
ExitUtil.ExitException
:
the exception is passed up unmodified.
ExitCodeProvider
:
A new ServiceLaunchException
is created with the exit code
and message of the thrown exception; the thrown exception becomes the
cause.ServiceLaunchException
is created
with the exit code LauncherExitCodes.EXIT_EXCEPTION_THROWN
and
the message of the original exception (which becomes the cause).org.apache.hadoop.util.ExitUtil.ExitException
- an exception passed
up as the exit code and error text.Exception
- any exception to report. If it provides an exit code
this is used in a wrapping exception.Copyright © 2018 Apache Software Foundation. All rights reserved.