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 java.util.List<rx.Observable<LifecycleState>> |
endpointStates
The current list of endpoint states.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractService(java.lang.String hostname,
java.lang.String bucket,
java.lang.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 |
---|---|
rx.Observable<LifecycleState> |
connect()
|
rx.Observable<LifecycleState> |
disconnect()
|
protected static java.lang.String |
logIdent(java.lang.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 java.util.List<rx.Observable<LifecycleState>> endpointStates
The current list of endpoint states.
protected AbstractService(java.lang.String hostname, java.lang.String bucket, java.lang.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 rx.Observable<LifecycleState> connect()
Service
public rx.Observable<LifecycleState> disconnect()
Service
disconnect
in interface Service
Service
after the disconnect process for all enabled Endpoint
s.protected static java.lang.String logIdent(java.lang.String hostname, Service service)
Simple log helper to give logs a common prefix.
hostname
- the address.service
- the service.