Class AbstractDynamicService
java.lang.Object
com.couchbase.client.core.state.AbstractStateMachine<LifecycleState>
com.couchbase.client.core.service.AbstractDynamicService
- All Implemented Interfaces:
Service
,Stateful<LifecycleState>
- Direct Known Subclasses:
AbstractLazyService
,AbstractOnDemandService
,AbstractPoolingService
public abstract class AbstractDynamicService
extends AbstractStateMachine<LifecycleState>
implements Service
Parent implementation of a dynamic
Service
.- Since:
- 1.1.0
- Author:
- Michael Nitschinger
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.couchbase.client.core.service.Service
Service.EndpointFactory
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractDynamicService
(String hostname, String bucket, String username, String password, int port, CoreContext ctx, int minEndpoints, Service.EndpointFactory endpointFactory) -
Method Summary
Modifier and TypeMethodDescriptionrx.Observable<LifecycleState>
connect()
protected Endpoint
Helper method to create a new endpoint.rx.Observable<EndpointHealth>
Returns endpoint health information for all endpoints this service is currently associated with.rx.Observable<LifecycleState>
protected abstract void
dispatch
(CouchbaseRequest request) Returns the current list of endpoints.protected EndpointStateZipper
Returns the underlying endpoint state zipper.protected static String
Simple log helper to give logs a common prefix.mapping()
Returns the mapping for the givenService
.void
send
(CouchbaseRequest request) Sends aCouchbaseRequest
into the service and eventually returns aCouchbaseResponse
.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.Methods inherited from class com.couchbase.client.core.state.AbstractStateMachine
hasSubscribers, isState, state, states, transitionState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.couchbase.client.core.state.Stateful
hasSubscribers, isState, state, states
-
Constructor Details
-
AbstractDynamicService
protected AbstractDynamicService(String hostname, String bucket, String username, String password, int port, CoreContext ctx, int minEndpoints, Service.EndpointFactory endpointFactory)
-
-
Method Details
-
dispatch
-
connect
Description copied from interface:Service
-
send
Description copied from interface:Service
Sends aCouchbaseRequest
into the service and eventually returns aCouchbaseResponse
. TheCouchbaseResponse
is not returned directly, but is wrapped into aObservable
. -
disconnect
Description copied from interface:Service
- Specified by:
disconnect
in interfaceService
- Returns:
- the states of the
Service
after the disconnect process for all enabledEndpoint
s.
-
mapping
Description copied from interface:Service
Returns the mapping for the givenService
. -
diagnostics
Description copied from interface:Service
Returns endpoint health information for all endpoints this service is currently associated with.- Specified by:
diagnostics
in interfaceService
-
createEndpoint
Helper method to create a new endpoint.- Returns:
- the endpoint to create.
-
logIdent
Simple log helper to give logs a common prefix.- Parameters:
hostname
- the address.service
- the service.- Returns:
- a prefix string for logs.
-
endpoints
Returns the current list of endpoints.- Returns:
- the list of endpoints.
-
endpointStates
Returns the underlying endpoint state zipper.- Returns:
- the underlying state zipper.
-
whenState
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.- Parameters:
endpoint
- the endpoint to monitor.wanted
- the wanted state.then
- the action to execute when the state is reached.
-