public class CouchbaseNode extends AbstractStateMachine<LifecycleState> implements Node
The general implementation of a Node.
A Node manages one or more Services. When a node gets connected, all currently configured Services are connected. Those can and will also be added and removed on demand. On disconnect, all services will be shut down asynchronously and then the node is determined to be shutdown.
A Nodes states is composed exclusively of the underlying Service states.
| Constructor and Description |
|---|
CouchbaseNode(NetworkAddress hostname,
CoreEnvironment environment,
com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer) |
| Modifier and Type | Method and Description |
|---|---|
rx.Observable<Service> |
addService(AddServiceRequest request) |
rx.Observable<LifecycleState> |
connect()
Connects all currently enabled
Services. |
rx.Observable<LifecycleState> |
disconnect()
Disconnects all currently enabled
Services. |
boolean |
equals(Object o) |
int |
hashCode() |
NetworkAddress |
hostname()
Returns the configured hostname for the
Node. |
protected static String |
logIdent(NetworkAddress hostname)
Simple log helper to give logs a common prefix.
|
rx.Observable<Service> |
removeService(RemoveServiceRequest request) |
void |
send(CouchbaseRequest request)
Sends a
CouchbaseRequest into the node and eventually returns a CouchbaseResponse. |
boolean |
serviceEnabled(ServiceType type)
True if the given
ServiceType is currently enabled on this node, false otherwise. |
String |
toString() |
hasSubscribers, isState, state, states, transitionStateclone, finalize, getClass, notify, notifyAll, wait, wait, waithasSubscribers, isState, state, statespublic CouchbaseNode(NetworkAddress hostname, CoreEnvironment environment, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)
public void send(CouchbaseRequest request)
NodeSends a CouchbaseRequest into the node and eventually returns a CouchbaseResponse.
The CouchbaseResponse is not returned directly, but is wrapped into a Observable.
public NetworkAddress hostname()
NodeReturns the configured hostname for the Node.
public rx.Observable<LifecycleState> connect()
NodeConnects all currently enabled Services.
public rx.Observable<LifecycleState> disconnect()
NodeDisconnects all currently enabled Services.
disconnect in interface NodeNode after the disconnect process for all enabled Services.public rx.Observable<Service> addService(AddServiceRequest request)
addService in interface Nodepublic rx.Observable<Service> removeService(RemoveServiceRequest request)
removeService in interface Nodeprotected static String logIdent(NetworkAddress hostname)
Simple log helper to give logs a common prefix.
hostname - the address.public boolean serviceEnabled(ServiceType type)
NodeTrue if the given ServiceType is currently enabled on this node, false otherwise.
serviceEnabled in interface NodeCopyright © 2017 Couchbase, Inc.. All rights reserved.