public static interface Service.Instance extends Closeable
Modifier and Type | Method and Description |
---|---|
com.google.common.io.Closer |
getCloser()
Returns a
Closer for convenience, where you can register Closeable s that should be closed when the application exits. |
com.typesafe.config.Config |
getConfig()
Returns the configuration for this service instance.
|
com.google.common.util.concurrent.ListeningExecutorService |
getExecutorService()
Returns a shared
ListeningExecutorService that has
virtually infinite capacity and that can be used for long-running jobs. |
com.google.common.util.concurrent.ListeningScheduledExecutorService |
getScheduledExecutorService()
Returns a shared
ListeningScheduledExecutorService
that has capacity appropriate for scheduled jobs, i.e. |
Service |
getService()
Returns the service that this is an instance of.
|
Service.Signaller |
getSignaller()
Returns a signaller that can be used to send signals to this service instance.
|
com.google.common.collect.ImmutableList<String> |
getUnprocessedArgs()
Returns the list of command-line arguments that were not recognized by Apollo, in order.
|
boolean |
isShutdown()
Returns whether the service has gotten a shutdown signal, meaning that
waitForShutdown() will not block. |
<T> T |
resolve(Class<T> type)
Get an instance provided by one of the Apollo modules.
|
void |
waitForShutdown()
A method that will block until the service has stopped.
|
Service getService()
com.typesafe.config.Config getConfig()
com.google.common.util.concurrent.ListeningExecutorService getExecutorService()
ListeningExecutorService
that has
virtually infinite capacity and that can be used for long-running jobs. This executor is
scoped along with the service instance, which avoids the need to use the very problematic
daemon threads.ListeningExecutorService
.com.google.common.util.concurrent.ListeningScheduledExecutorService getScheduledExecutorService()
ListeningScheduledExecutorService
that has capacity appropriate for scheduled jobs, i.e. jobs that run periodically and have a
limited execution time. Use getExecutorService()
for jobs that run forever. This
executor is scoped along with the service instance, which avoids the need to use the very
problematic daemon threads.ListeningScheduledExecutorService
.com.google.common.io.Closer getCloser()
Closer
for convenience, where you can register Closeable
s that should be closed when the application exits.Closer
for convenience.com.google.common.collect.ImmutableList<String> getUnprocessedArgs()
Service.Signaller getSignaller()
<T> T resolve(Class<T> type)
type
- the type of the instance to get.ApolloConfigurationException
- if no suitable instance of this type can be found.void waitForShutdown() throws InterruptedException
InterruptedException
boolean isShutdown()
waitForShutdown()
will not block.Copyright © 2016. All rights reserved.