public abstract class AbstractDynamicService extends AbstractStateMachine<LifecycleState> implements Service
Parent implementation of a dynamic Service
.
Service.EndpointFactory
Modifier | Constructor and Description |
---|---|
protected |
AbstractDynamicService(String hostname,
String bucket,
String username,
String password,
int port,
CoreContext ctx,
int minEndpoints,
Service.EndpointFactory endpointFactory) |
Modifier and Type | Method and Description |
---|---|
rx.Observable<LifecycleState> |
connect()
|
protected Endpoint |
createEndpoint()
Helper method to create a new endpoint.
|
rx.Observable<EndpointHealth> |
diagnostics()
Returns endpoint health information for all endpoints this service is currently associated with.
|
rx.Observable<LifecycleState> |
disconnect()
|
protected abstract void |
dispatch(CouchbaseRequest request) |
protected List<Endpoint> |
endpoints()
Returns the current list of endpoints.
|
protected EndpointStateZipper |
endpointStates()
Returns the underlying endpoint state zipper.
|
protected static String |
logIdent(String hostname,
Service service)
Simple log helper to give logs a common prefix.
|
BucketServiceMapping |
mapping()
Returns the mapping for the given
Service . |
void |
send(CouchbaseRequest request)
Sends a
CouchbaseRequest into the service and eventually returns a CouchbaseResponse . |
protected static void |
whenState(Endpoint endpoint,
LifecycleState wanted,
rx.functions.Action1<LifecycleState> then)
Waits until the endpoint goes into the given state, calls the action and then unsubscribes.
|
hasSubscribers, isState, state, states, transitionState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasSubscribers, isState, state, states
protected AbstractDynamicService(String hostname, String bucket, String username, String password, int port, CoreContext ctx, int minEndpoints, Service.EndpointFactory endpointFactory)
protected abstract void dispatch(CouchbaseRequest request)
public rx.Observable<LifecycleState> connect()
Service
public void send(CouchbaseRequest request)
Service
Sends a CouchbaseRequest
into the service and eventually returns a CouchbaseResponse
.
The CouchbaseResponse
is not returned directly, but is wrapped into a Observable
.
public rx.Observable<LifecycleState> disconnect()
Service
disconnect
in interface Service
Service
after the disconnect process for all enabled Endpoint
s.public BucketServiceMapping mapping()
Service
Returns the mapping for the given Service
.
public rx.Observable<EndpointHealth> diagnostics()
Service
Returns endpoint health information for all endpoints this service is currently associated with.
diagnostics
in interface Service
protected Endpoint createEndpoint()
Helper method to create a new endpoint.
protected static String logIdent(String hostname, Service service)
Simple log helper to give logs a common prefix.
hostname
- the address.service
- the service.protected List<Endpoint> endpoints()
Returns the current list of endpoints.
protected EndpointStateZipper endpointStates()
Returns the underlying endpoint state zipper.
protected static void whenState(Endpoint endpoint, LifecycleState wanted, rx.functions.Action1<LifecycleState> then)
Waits until the endpoint goes into the given state, calls the action and then unsubscribes.
endpoint
- the endpoint to monitor.wanted
- the wanted state.then
- the action to execute when the state is reached.Copyright © 2018 Couchbase, Inc.. All rights reserved.