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
;
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)}.
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
34 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience
.COPROC
)
35 @InterfaceStability.Evolving
36 public class NoLimitScannerContext
extends ScannerContext
{
38 public NoLimitScannerContext() {
39 super(false, null, false);
43 * Use this instance whenever limits do not need to be enforced.
45 private static final ScannerContext NO_LIMIT
= new NoLimitScannerContext();
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() {
56 void setKeepProgress(boolean keepProgress
) {
57 // Do nothing. NoLimitScannerContext instances are immutable post-construction
61 void setBatchProgress(int batchProgress
) {
62 // Do nothing. NoLimitScannerContext instances are immutable post-construction
66 void setSizeProgress(long sizeProgress
, long heapSizeProgress
) {
67 // Do nothing. NoLimitScannerContext instances are immutable post-construction
71 void setProgress(int batchProgress
, long sizeProgress
, long heapSizeProgress
) {
72 // Do nothing. NoLimitScannerContext instances are immutable post-construction
76 void clearProgress() {
77 // Do nothing. NoLimitScannerContext instances are immutable post-construction
81 void setSizeLimitScope(LimitScope scope
) {
82 // Do nothing. NoLimitScannerContext instances are immutable post-construction
86 void setTimeLimitScope(LimitScope scope
) {
87 // Do nothing. NoLimitScannerContext instances are immutable post-construction
91 NextState
setScannerState(NextState state
) {
92 // Do nothing. NoLimitScannerContext instances are immutable post-construction
97 boolean checkBatchLimit(LimitScope checkerScope
) {
98 // No limits can be specified, thus return false to indicate no limit has been reached.
103 boolean checkSizeLimit(LimitScope checkerScope
) {
104 // No limits can be specified, thus return false to indicate no limit has been reached.
109 boolean checkTimeLimit(LimitScope checkerScope
) {
110 // No limits can be specified, thus return false to indicate no limit has been reached.
115 boolean checkAnyLimitReached(LimitScope checkerScope
) {