HBASE-26412 Handle sink failure in RegionReplicationSink (#3815)
[hbase.git] / hbase-server / src / main / java / org / apache / hadoop / hbase / regionserver / NoLimitScannerContext.java
blob26d819214f1f6e26efb09626db4f2f50fbf87136
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.regionserver;
20 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
21 import org.apache.yetus.audience.InterfaceAudience;
22 import org.apache.yetus.audience.InterfaceStability;
24 /**
25 * This is a special {@link ScannerContext} subclass that is designed to be used globally when
26 * limits should not be enforced during invocations of {@link InternalScanner#next(java.util.List)}
27 * or {@link RegionScanner#next(java.util.List)}.
28 * <p>
29 * Instances of {@link NoLimitScannerContext} are immutable after construction. Any attempt to
30 * change the limits or progress of a {@link NoLimitScannerContext} will fail silently. The net
31 * effect is that all limit checks will return false, thus indicating that a limit has not been
32 * reached.
34 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
35 @InterfaceStability.Evolving
36 public class NoLimitScannerContext extends ScannerContext {
38 public NoLimitScannerContext() {
39 super(false, null, false);
42 /**
43 * Use this instance whenever limits do not need to be enforced.
45 private static final ScannerContext NO_LIMIT = new NoLimitScannerContext();
47 /**
48 * @return The static, immutable instance of {@link NoLimitScannerContext} to be used whenever
49 * limits should not be enforced
51 public static final ScannerContext getInstance() {
52 return NO_LIMIT;
55 @Override
56 void setKeepProgress(boolean keepProgress) {
57 // Do nothing. NoLimitScannerContext instances are immutable post-construction
60 @Override
61 void setBatchProgress(int batchProgress) {
62 // Do nothing. NoLimitScannerContext instances are immutable post-construction
65 @Override
66 void setSizeProgress(long sizeProgress, long heapSizeProgress) {
67 // Do nothing. NoLimitScannerContext instances are immutable post-construction
70 @Override
71 void setProgress(int batchProgress, long sizeProgress, long heapSizeProgress) {
72 // Do nothing. NoLimitScannerContext instances are immutable post-construction
75 @Override
76 void clearProgress() {
77 // Do nothing. NoLimitScannerContext instances are immutable post-construction
80 @Override
81 void setSizeLimitScope(LimitScope scope) {
82 // Do nothing. NoLimitScannerContext instances are immutable post-construction
85 @Override
86 void setTimeLimitScope(LimitScope scope) {
87 // Do nothing. NoLimitScannerContext instances are immutable post-construction
90 @Override
91 NextState setScannerState(NextState state) {
92 // Do nothing. NoLimitScannerContext instances are immutable post-construction
93 return state;
96 @Override
97 boolean checkBatchLimit(LimitScope checkerScope) {
98 // No limits can be specified, thus return false to indicate no limit has been reached.
99 return false;
102 @Override
103 boolean checkSizeLimit(LimitScope checkerScope) {
104 // No limits can be specified, thus return false to indicate no limit has been reached.
105 return false;
108 @Override
109 boolean checkTimeLimit(LimitScope checkerScope) {
110 // No limits can be specified, thus return false to indicate no limit has been reached.
111 return false;
114 @Override
115 boolean checkAnyLimitReached(LimitScope checkerScope) {
116 return false;