public class CouchbaseNode extends AbstractStateMachine<LifecycleState> implements Node
The general implementation of a Node
.
A Node
manages one or more Service
s. When a node gets connected, all currently configured Service
s 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 Node
s states is composed exclusively of the underlying Service
states.
Constructor and Description |
---|
CouchbaseNode(java.net.InetAddress 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
Service s. |
rx.Observable<LifecycleState> |
disconnect()
Disconnects all currently enabled
Service s. |
java.net.InetAddress |
hostname()
Returns the configured hostname for the
Node . |
rx.Observable<Service> |
removeService(RemoveServiceRequest request) |
void |
send(CouchbaseRequest request)
Sends a
CouchbaseRequest into the node and eventually returns a CouchbaseResponse . |
java.lang.String |
toString() |
isState, state, states, transitionState
public CouchbaseNode(java.net.InetAddress hostname, CoreEnvironment environment, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)
public void send(CouchbaseRequest request)
Node
Sends a CouchbaseRequest
into the node and eventually returns a CouchbaseResponse
.
The CouchbaseResponse
is not returned directly, but is wrapped into a Observable
.
public java.net.InetAddress hostname()
Node
Returns the configured hostname for the Node
.
public rx.Observable<LifecycleState> connect()
Node
Connects all currently enabled Service
s.
public rx.Observable<LifecycleState> disconnect()
Node
Disconnects all currently enabled Service
s.
disconnect
in interface Node
Node
after the disconnect process for all enabled Service
s.public rx.Observable<Service> addService(AddServiceRequest request)
addService
in interface Node
public rx.Observable<Service> removeService(RemoveServiceRequest request)
removeService
in interface Node
public java.lang.String toString()
toString
in class java.lang.Object