use of com.couchbase.client.core.retry.RetryStrategy in project couchbase-jvm-clients by couchbase.
the class AsyncCollection method getAndLockRequest.
/**
* Helper method to create the get and lock request.
*
* @param id the document id which is used to uniquely identify it.
* @param lockTime how long to lock the document for. Any values above 30 seconds will be
* treated as 30 seconds.
* @param opts custom options to change the default behavior.
* @return the get and lock request.
*/
@Stability.Internal
GetAndLockRequest getAndLockRequest(final String id, final Duration lockTime, final GetAndLockOptions.Built opts) {
notNullOrEmpty(id, "Id", () -> ReducedKeyValueErrorContext.create(id, collectionIdentifier));
notNull(lockTime, "LockTime", () -> ReducedKeyValueErrorContext.create(id, collectionIdentifier));
Duration timeout = opts.timeout().orElse(environment.timeoutConfig().kvTimeout());
RetryStrategy retryStrategy = opts.retryStrategy().orElse(environment.retryStrategy());
RequestSpan span = environment.requestTracer().requestSpan(TracingIdentifiers.SPAN_REQUEST_KV_GET_AND_LOCK, opts.parentSpan().orElse(null));
GetAndLockRequest request = new GetAndLockRequest(id, timeout, coreContext, collectionIdentifier, retryStrategy, lockTime, span);
request.context().clientContext(opts.clientContext());
return request;
}
Aggregations