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
;
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();
52 public AsyncAdminBuilder
setOperationTimeout(long timeout
, TimeUnit unit
) {
53 this.operationTimeoutNs
= unit
.toNanos(timeout
);
58 public AsyncAdminBuilder
setRpcTimeout(long timeout
, TimeUnit unit
) {
59 this.rpcTimeoutNs
= unit
.toNanos(timeout
);
64 public AsyncAdminBuilder
setRetryPause(long timeout
, TimeUnit unit
) {
65 this.pauseNs
= unit
.toNanos(timeout
);
70 public AsyncAdminBuilder
setRetryPauseForCQTBE(long timeout
, TimeUnit unit
) {
71 this.pauseForCQTBENs
= unit
.toNanos(timeout
);
76 public AsyncAdminBuilder
setMaxAttempts(int maxAttempts
) {
77 this.maxAttempts
= maxAttempts
;
82 public AsyncAdminBuilder
setStartLogErrorsCnt(int startLogErrorsCnt
) {
83 this.startLogErrorsCnt
= startLogErrorsCnt
;