public final class Services extends Object
Service
.Modifier and Type | Method and Description |
---|---|
static com.google.common.util.concurrent.ListenableFuture<List<com.google.common.util.concurrent.ListenableFuture<com.google.common.util.concurrent.Service.State>>> |
chainStart(com.google.common.util.concurrent.Service firstService,
com.google.common.util.concurrent.Service... moreServices)
Starts a list of
Service one by one. |
static com.google.common.util.concurrent.ListenableFuture<List<com.google.common.util.concurrent.ListenableFuture<com.google.common.util.concurrent.Service.State>>> |
chainStop(com.google.common.util.concurrent.Service firstService,
com.google.common.util.concurrent.Service... moreServices)
Stops a list of
Service one by one. |
static com.google.common.util.concurrent.ListenableFuture<com.google.common.util.concurrent.Service.State> |
getCompletionFuture(com.google.common.util.concurrent.Service service)
Returns a
ListenableFuture that will be completed when the given service is stopped. |
public static com.google.common.util.concurrent.ListenableFuture<List<com.google.common.util.concurrent.ListenableFuture<com.google.common.util.concurrent.Service.State>>> chainStart(com.google.common.util.concurrent.Service firstService, com.google.common.util.concurrent.Service... moreServices)
Service
one by one. Starting of next Service is triggered from the callback listener
thread of the previous Service.firstService
- First service to start.moreServices
- The rest services to start.ListenableFuture
that will be completed when all services are started, with the
result carries the completed ListenableFuture
of each corresponding service in the
same order as they are passed to this method.public static com.google.common.util.concurrent.ListenableFuture<List<com.google.common.util.concurrent.ListenableFuture<com.google.common.util.concurrent.Service.State>>> chainStop(com.google.common.util.concurrent.Service firstService, com.google.common.util.concurrent.Service... moreServices)
Service
one by one. It behaves the same as
chainStart(com.google.common.util.concurrent.Service, com.google.common.util.concurrent.Service...)
except Service.stop()
is called instead of start.firstService
- First service to stop.moreServices
- The rest services to stop.ListenableFuture
that will be completed when all services are stopped.chainStart(com.google.common.util.concurrent.Service, com.google.common.util.concurrent.Service...)
public static com.google.common.util.concurrent.ListenableFuture<com.google.common.util.concurrent.Service.State> getCompletionFuture(com.google.common.util.concurrent.Service service)
ListenableFuture
that will be completed when the given service is stopped. If the service
stopped due to error, the failure cause would be reflected in the future.service
- The Service
to block on.ListenableFuture
that will be completed when the service is stopped.Copyright © 2013-2020 The Apache Software Foundation. All rights reserved.