public abstract class AbstractService extends AbstractStateMachine<LifecycleState> implements Service
The base implementation for all Service
s.
Service.EndpointFactory
Modifier and Type | Field and Description |
---|---|
protected List<Observable<LifecycleState>> |
endpointStates
The current list of endpoint states.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractService(String hostname,
String bucket,
String password,
int port,
CoreEnvironment env,
int numEndpoints,
SelectionStrategy strategy,
com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer,
Service.EndpointFactory factory)
Creates a new
AbstractService and instantiates needed components and flows. |
Modifier and Type | Method and Description |
---|---|
Observable<LifecycleState> |
connect()
|
Observable<LifecycleState> |
disconnect()
|
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 . |
isState, state, states, transitionState
protected List<Observable<LifecycleState>> endpointStates
The current list of endpoint states.
protected AbstractService(String hostname, String bucket, String password, int port, CoreEnvironment env, int numEndpoints, SelectionStrategy strategy, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer, Service.EndpointFactory factory)
Creates a new AbstractService
and instantiates needed components and flows.
hostname
- the hostname of the service.bucket
- the name of the bucket.password
- the password of the bucket.port
- the port of the service.env
- the shared environment.numEndpoints
- the number of endpoints to init.strategy
- the endpoint selection strategy used.responseBuffer
- the shared response buffer.factory
- the endpoint factory.public BucketServiceMapping mapping()
Service
Returns the mapping for the given 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 Observable<LifecycleState> connect()
Service
public Observable<LifecycleState> disconnect()
Service
disconnect
in interface Service
Service
after the disconnect process for all enabled Endpoint
s.Copyright © 2014 Couchbase, Inc.