public static interface Service.Builder
Modifier and Type | Method and Description |
---|---|
Service |
build()
Creates a new service based off of this builder.
|
Service.Builder |
usingModuleDiscovery(boolean moduleDiscovery)
Enables or disables module discovery, which will use SPI to discover all available modules on
the classpath.
|
Service.Builder |
withCliHelp(boolean enabled)
Enables/disables whether Apollo should handle the
--help/-h flags and display
command-line help. |
Service.Builder |
withEnvVarPrefix(String prefix)
Sets the prefix that is used to convert environment variables into configuration keys.
|
Service.Builder |
withModule(ApolloModule module)
Registers the specified module as loadable by this service.
|
Service.Builder |
withRuntime(Runtime runtime)
The Java runtime to use when constructing service instances.
|
Service.Builder |
withShutdownInterrupt(boolean enabled)
Enables/disables whether the thread calling
Service.start(String...) will be
interrupted when the application is requested to shut down. |
Service.Builder |
withWatchdogTimeout(long timeout,
TimeUnit unit)
Sets the timeout for how long Apollo will wait for the service to clean itself up upon
shutdown.
|
Service.Builder withModule(ApolloModule module)
module
- The module to register.Service.Builder usingModuleDiscovery(boolean moduleDiscovery)
moduleDiscovery
- true
if module discovery should be used, false
otherwise.Service.Builder withShutdownInterrupt(boolean enabled)
Service.start(String...)
will be
interrupted when the application is requested to shut down. The default is to not interrupt
the thread.enabled
- true
if Thread.interrupt()
should be called on the thread that
called Service.start(String...)
when the service is signalled to shut down;
false
if nothing should happen.Service.Builder withCliHelp(boolean enabled)
--help/-h
flags and display
command-line help. The default is to handle the flags.enabled
- true
if Apollo should intercept --help/-h
, false
otherwise.Service.Builder withEnvVarPrefix(String prefix)
"APOLLO"
, which means that an environment variable like
"APOLLO_DOMAIN_NAME"
is translated into the config key "domain.name"
.prefix
- The environment variable prefix to use.Service.Builder withWatchdogTimeout(long timeout, TimeUnit unit)
timeout
- The timeout value.unit
- The time unit of the timeout value.Service.Builder withRuntime(Runtime runtime)
runtime
- The Java runtime to use when constructing service instances.Service build()
Copyright © 2016. All rights reserved.