Package com.couchbase.client.core.node
Class CouchbaseNode
- java.lang.Object
-
- com.couchbase.client.core.state.AbstractStateMachine<LifecycleState>
-
- com.couchbase.client.core.node.CouchbaseNode
-
- All Implemented Interfaces:
Node
,Stateful<LifecycleState>
public class CouchbaseNode extends AbstractStateMachine<LifecycleState> implements Node
The general implementation of aNode
. ANode
manages one or moreService
s. When a node gets connected, all currently configuredService
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. ANode
s states is composed exclusively of the underlyingService
states.- Since:
- 2.0
- Author:
- Michael Nitschinger
-
-
Constructor Summary
Constructors Constructor Description CouchbaseNode(String hostname, CoreContext ctx)
CouchbaseNode(String hostname, CoreContext ctx, String alternate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description rx.Observable<Service>
addService(AddServiceRequest request)
rx.Observable<LifecycleState>
connect()
Connects all currently enabledService
s.rx.Observable<EndpointHealth>
diagnostics()
Returns endpoint health information for all endpoints this node is currently associated with.rx.Observable<LifecycleState>
disconnect()
Disconnects all currently enabledService
s.boolean
equals(Object o)
int
hashCode()
String
hostname()
Returns the configured hostname for theNode
.rx.Observable<Service>
removeService(RemoveServiceRequest request)
void
send(CouchbaseRequest request)
Sends aCouchbaseRequest
into the node and eventually returns aCouchbaseResponse
.boolean
serviceEnabled(ServiceType type)
True if the givenServiceType
is currently enabled on this node, false otherwise.String
toString()
-
Methods inherited from class com.couchbase.client.core.state.AbstractStateMachine
hasSubscribers, isState, state, states, transitionState
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.couchbase.client.core.state.Stateful
hasSubscribers, isState, state, states
-
-
-
-
Constructor Detail
-
CouchbaseNode
public CouchbaseNode(String hostname, CoreContext ctx)
-
CouchbaseNode
public CouchbaseNode(String hostname, CoreContext ctx, String alternate)
-
-
Method Detail
-
send
public void send(CouchbaseRequest request)
Description copied from interface:Node
Sends aCouchbaseRequest
into the node and eventually returns aCouchbaseResponse
. TheCouchbaseResponse
is not returned directly, but is wrapped into aObservable
.
-
hostname
public String hostname()
Description copied from interface:Node
Returns the configured hostname for theNode
.
-
connect
public rx.Observable<LifecycleState> connect()
Description copied from interface:Node
Connects all currently enabledService
s.
-
disconnect
public rx.Observable<LifecycleState> disconnect()
Description copied from interface:Node
Disconnects all currently enabledService
s.- Specified by:
disconnect
in interfaceNode
- Returns:
- the states of the
Node
after the disconnect process for all enabledService
s.
-
addService
public rx.Observable<Service> addService(AddServiceRequest request)
- Specified by:
addService
in interfaceNode
-
removeService
public rx.Observable<Service> removeService(RemoveServiceRequest request)
- Specified by:
removeService
in interfaceNode
-
diagnostics
public rx.Observable<EndpointHealth> diagnostics()
Description copied from interface:Node
Returns endpoint health information for all endpoints this node is currently associated with.- Specified by:
diagnostics
in interfaceNode
-
serviceEnabled
public boolean serviceEnabled(ServiceType type)
Description copied from interface:Node
True if the givenServiceType
is currently enabled on this node, false otherwise.- Specified by:
serviceEnabled
in interfaceNode
-
-