HBASE-25617 Revisit the span names (#2998)
[hbase.git] / hbase-client / src / main / java / org / apache / hadoop / hbase / client / AsyncAdminBuilderBase.java
blobffb3ae97ecffa0a9a779c1833f9944e97bb31e11
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org.apache.hadoop.hbase.client;
20 import java.util.concurrent.TimeUnit;
22 import org.apache.yetus.audience.InterfaceAudience;
24 /**
25 * Base class for all asynchronous admin builders.
27 @InterfaceAudience.Private
28 abstract class AsyncAdminBuilderBase implements AsyncAdminBuilder {
30 protected long rpcTimeoutNs;
32 protected long operationTimeoutNs;
34 protected long pauseNs;
36 protected long pauseForCQTBENs;
38 protected int maxAttempts;
40 protected int startLogErrorsCnt;
42 AsyncAdminBuilderBase(AsyncConnectionConfiguration connConf) {
43 this.rpcTimeoutNs = connConf.getRpcTimeoutNs();
44 this.operationTimeoutNs = connConf.getOperationTimeoutNs();
45 this.pauseNs = connConf.getPauseNs();
46 this.pauseForCQTBENs = connConf.getPauseForCQTBENs();
47 this.maxAttempts = connConf.getMaxRetries();
48 this.startLogErrorsCnt = connConf.getStartLogErrorsCnt();
51 @Override
52 public AsyncAdminBuilder setOperationTimeout(long timeout, TimeUnit unit) {
53 this.operationTimeoutNs = unit.toNanos(timeout);
54 return this;
57 @Override
58 public AsyncAdminBuilder setRpcTimeout(long timeout, TimeUnit unit) {
59 this.rpcTimeoutNs = unit.toNanos(timeout);
60 return this;
63 @Override
64 public AsyncAdminBuilder setRetryPause(long timeout, TimeUnit unit) {
65 this.pauseNs = unit.toNanos(timeout);
66 return this;
69 @Override
70 public AsyncAdminBuilder setRetryPauseForCQTBE(long timeout, TimeUnit unit) {
71 this.pauseForCQTBENs = unit.toNanos(timeout);
72 return this;
75 @Override
76 public AsyncAdminBuilder setMaxAttempts(int maxAttempts) {
77 this.maxAttempts = maxAttempts;
78 return this;
81 @Override
82 public AsyncAdminBuilder setStartLogErrorsCnt(int startLogErrorsCnt) {
83 this.startLogErrorsCnt = startLogErrorsCnt;
84 return this;