Class KeyValueService
- java.lang.Object
-
- com.couchbase.client.core.service.KeyValueService
-
-
Constructor Summary
Constructors Constructor Description KeyValueService(ServiceConfig serviceConfig, CoreContext coreContext, String hostname, int port, String bucketname, Credentials credentials)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
Instruct thisService
to connect.ServiceContext
context()
protected Endpoint
createEndpoint()
Subclass implements this method to create new endpoints.void
disconnect()
Instruct thisService
to disconnect.protected Duration
idleTimeCheckInterval()
Can be overridden for unit tests.protected EndpointSelectionStrategy
selectionStrategy()
Subclass implements this method to pick their selection strategy of choice.<R extends Request<? extends Response>>
voidsend(R request)
Sends the request into thisService
.protected ServiceContext
serviceContext()
Returns the createdServiceContext
for implementations to use.ServiceState
state()
Returns the current state of thisService
.ServiceType
type()
-
-
-
Constructor Detail
-
KeyValueService
public KeyValueService(ServiceConfig serviceConfig, CoreContext coreContext, String hostname, int port, String bucketname, Credentials credentials)
-
-
Method Detail
-
createEndpoint
protected Endpoint createEndpoint()
Subclass implements this method to create new endpoints.- Returns:
- the created endpoint.
-
selectionStrategy
protected EndpointSelectionStrategy selectionStrategy()
Subclass implements this method to pick their selection strategy of choice.- Returns:
- the selection strategy.
-
type
public ServiceType type()
-
serviceContext
protected ServiceContext serviceContext()
Returns the createdServiceContext
for implementations to use.
-
idleTimeCheckInterval
protected Duration idleTimeCheckInterval()
Can be overridden for unit tests.
-
send
public <R extends Request<? extends Response>> void send(R request)
Description copied from interface:Service
Sends the request into thisService
.Note that there is no guarantee that the request will actually dispatched, based on the state this service is in.
-
connect
public void connect()
Description copied from interface:Service
Instruct thisService
to connect.This method is async and will return immediately. Use the other methods available to inspect the current state of the service, signaling potential successful connection attempts.
-
disconnect
public void disconnect()
Description copied from interface:Service
Instruct thisService
to disconnect.This method is async and will return immediately. Use the other methods available to inspect the current state of the service, signaling potential successful disconnection attempts.
- Specified by:
disconnect
in interfaceService
-
context
public ServiceContext context()
-
state
public ServiceState state()
Description copied from interface:Service
Returns the current state of thisService
.
-
-