You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2022/07/27 22:58:46 UTC
[hbase] branch branch-2 updated: HBASE-27203 Clean up error-prone findings in hbase-client [branch-2] (#4651)
This is an automated email from the ASF dual-hosted git repository.
apurtell pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new 29f51c05f0d HBASE-27203 Clean up error-prone findings in hbase-client [branch-2] (#4651)
29f51c05f0d is described below
commit 29f51c05f0d2c80df01e5f0a940203ec8bf8c709
Author: Andrew Purtell <ap...@apache.org>
AuthorDate: Wed Jul 27 15:58:40 2022 -0700
HBASE-27203 Clean up error-prone findings in hbase-client [branch-2] (#4651)
Signed-off-by: Duo Zhang <zh...@apache.org>
Signed-off-by: Viraj Jasani <vj...@apache.org>
---
.../hadoop/hbase/AsyncMetaTableAccessor.java | 61 ++++++++++---------
.../java/org/apache/hadoop/hbase/ClusterId.java | 1 +
.../apache/hadoop/hbase/ClusterMetricsBuilder.java | 4 +-
.../org/apache/hadoop/hbase/ClusterStatus.java | 6 ++
.../hadoop/hbase/CoprocessorEnvironment.java | 4 +-
.../apache/hadoop/hbase/HBaseServerException.java | 5 +-
.../org/apache/hadoop/hbase/HColumnDescriptor.java | 60 +++++++------------
.../java/org/apache/hadoop/hbase/HRegionInfo.java | 68 +++++++++++++--------
.../org/apache/hadoop/hbase/HRegionLocation.java | 4 +-
.../org/apache/hadoop/hbase/HTableDescriptor.java | 7 ++-
.../org/apache/hadoop/hbase/MetaTableAccessor.java | 58 +++++++++---------
.../java/org/apache/hadoop/hbase/RegionLoad.java | 1 +
.../org/apache/hadoop/hbase/RegionLocations.java | 2 +
.../org/apache/hadoop/hbase/RegionMetrics.java | 4 +-
.../java/org/apache/hadoop/hbase/ServerLoad.java | 15 ++---
.../apache/hadoop/hbase/ServerMetricsBuilder.java | 19 +++---
.../java/org/apache/hadoop/hbase/UserMetrics.java | 4 +-
.../apache/hadoop/hbase/UserMetricsBuilder.java | 4 +-
.../hadoop/hbase/client/AbstractResponse.java | 6 +-
.../client/AbstractRpcBasedConnectionRegistry.java | 2 +-
.../java/org/apache/hadoop/hbase/client/Admin.java | 28 +++++----
.../org/apache/hadoop/hbase/client/Append.java | 3 +-
.../org/apache/hadoop/hbase/client/AsyncAdmin.java | 33 ++++++-----
.../client/AsyncAdminRequestRetryingCaller.java | 3 -
.../hbase/client/AsyncRequestFutureImpl.java | 13 ++--
.../org/apache/hadoop/hbase/client/AsyncTable.java | 69 ++++++++++++----------
.../hbase/client/AsyncTableRegionLocator.java | 2 -
.../hadoop/hbase/client/BufferedMutatorParams.java | 4 +-
.../CatalogReplicaLoadBalanceSimpleSelector.java | 10 ++--
.../apache/hadoop/hbase/client/CheckAndMutate.java | 8 +++
.../hbase/client/ClientAsyncPrefetchScanner.java | 39 ++++++------
.../hadoop/hbase/client/ClientIdGenerator.java | 18 +++---
.../apache/hadoop/hbase/client/ClientScanner.java | 4 +-
.../hadoop/hbase/client/ClientServiceCallable.java | 1 -
.../hadoop/hbase/client/ClusterConnection.java | 8 ++-
.../hbase/client/ColumnFamilyDescriptor.java | 26 ++++----
.../client/ColumnFamilyDescriptorBuilder.java | 69 ++++++++--------------
.../apache/hadoop/hbase/client/CompactType.java | 6 +-
.../hbase/client/ConnectionImplementation.java | 9 ++-
.../hadoop/hbase/client/ConnectionUtils.java | 1 +
.../org/apache/hadoop/hbase/client/Delete.java | 4 +-
.../java/org/apache/hadoop/hbase/client/Get.java | 2 +-
.../org/apache/hadoop/hbase/client/HBaseAdmin.java | 32 +++-------
.../apache/hadoop/hbase/client/HRegionLocator.java | 1 +
.../org/apache/hadoop/hbase/client/HTable.java | 9 ++-
.../hadoop/hbase/client/HTableMultiplexer.java | 2 +
.../org/apache/hadoop/hbase/client/Increment.java | 3 +-
.../apache/hadoop/hbase/client/IsolationLevel.java | 7 +--
.../apache/hadoop/hbase/client/LogQueryFilter.java | 5 +-
.../client/MasterCoprocessorRpcChannelImpl.java | 4 +-
.../apache/hadoop/hbase/client/MasterRegistry.java | 4 +-
.../apache/hadoop/hbase/client/MultiAction.java | 10 ++--
.../apache/hadoop/hbase/client/MultiResponse.java | 6 +-
.../hadoop/hbase/client/MultiServerCallable.java | 1 -
.../hadoop/hbase/client/MutableRegionInfo.java | 1 +
.../org/apache/hadoop/hbase/client/Mutation.java | 19 +++---
.../client/PreemptiveFastFailInterceptor.java | 11 ++--
.../java/org/apache/hadoop/hbase/client/Put.java | 1 +
.../java/org/apache/hadoop/hbase/client/Query.java | 7 ++-
.../hadoop/hbase/client/RawAsyncHBaseAdmin.java | 46 +++++++--------
.../hadoop/hbase/client/RawAsyncTableImpl.java | 2 +-
.../hbase/client/RegionCoprocessorServiceExec.java | 2 +-
.../org/apache/hadoop/hbase/client/RegionInfo.java | 33 ++++++-----
.../hadoop/hbase/client/RegionReplicaUtil.java | 4 +-
.../RegionServerCoprocessorRpcChannelImpl.java | 4 +-
.../org/apache/hadoop/hbase/client/Result.java | 5 +-
.../hadoop/hbase/client/RetryingCallable.java | 7 ++-
.../java/org/apache/hadoop/hbase/client/Row.java | 2 +
.../org/apache/hadoop/hbase/client/RowAccess.java | 1 -
.../apache/hadoop/hbase/client/RowMutations.java | 1 +
.../hbase/client/RpcRetryingCallerFactory.java | 16 -----
.../hadoop/hbase/client/RpcRetryingCallerImpl.java | 4 +-
.../java/org/apache/hadoop/hbase/client/Scan.java | 6 +-
.../hadoop/hbase/client/ScanResultConsumer.java | 3 +-
.../hbase/client/ScannerCallableWithReplicas.java | 9 +--
.../apache/hadoop/hbase/client/ServiceCaller.java | 8 +--
.../apache/hadoop/hbase/client/SlowLogParams.java | 5 +-
.../hadoop/hbase/client/SnapshotDescription.java | 1 +
.../java/org/apache/hadoop/hbase/client/Table.java | 10 ++++
.../hadoop/hbase/client/TableDescriptor.java | 7 ++-
.../hbase/client/TableDescriptorBuilder.java | 15 ++---
.../org/apache/hadoop/hbase/client/TableState.java | 18 +++---
.../client/backoff/ClientBackoffPolicyFactory.java | 4 --
.../backoff/ExponentialClientBackoffPolicy.java | 4 --
.../coprocessor/BigDecimalColumnInterpreter.java | 2 +-
.../hbase/client/replication/ReplicationAdmin.java | 3 -
.../replication/ReplicationPeerConfigUtil.java | 32 +++++-----
.../hbase/coprocessor/ColumnInterpreter.java | 11 ++--
.../hbase/exceptions/RegionOpeningException.java | 4 +-
.../hadoop/hbase/filter/BigDecimalComparator.java | 9 +--
.../hadoop/hbase/filter/BinaryComparator.java | 19 +++---
.../hbase/filter/BinaryComponentComparator.java | 8 +--
.../hbase/filter/BinaryPrefixComparator.java | 19 +++---
.../apache/hadoop/hbase/filter/BitComparator.java | 18 ++++--
.../hadoop/hbase/filter/ColumnCountGetFilter.java | 16 +++--
.../hbase/filter/ColumnPaginationFilter.java | 29 ++++-----
.../hadoop/hbase/filter/ColumnPrefixFilter.java | 17 +++---
.../hadoop/hbase/filter/ColumnRangeFilter.java | 11 ++--
.../hadoop/hbase/filter/ColumnValueFilter.java | 14 +++--
.../apache/hadoop/hbase/filter/CompareFilter.java | 12 ++--
.../hadoop/hbase/filter/DependentColumnFilter.java | 17 ++++--
.../apache/hadoop/hbase/filter/FamilyFilter.java | 18 ++++--
.../org/apache/hadoop/hbase/filter/Filter.java | 5 +-
.../org/apache/hadoop/hbase/filter/FilterList.java | 16 +++--
.../hadoop/hbase/filter/FilterListWithAND.java | 6 +-
.../hadoop/hbase/filter/FilterListWithOR.java | 6 +-
.../hadoop/hbase/filter/FirstKeyOnlyFilter.java | 21 ++++---
.../FirstKeyValueMatchingQualifiersFilter.java | 5 +-
.../apache/hadoop/hbase/filter/FuzzyRowFilter.java | 27 +++++----
.../hadoop/hbase/filter/InclusiveStopFilter.java | 20 ++++---
.../apache/hadoop/hbase/filter/KeyOnlyFilter.java | 19 +++---
.../apache/hadoop/hbase/filter/LongComparator.java | 14 +++--
.../hadoop/hbase/filter/MultiRowRangeFilter.java | 22 ++++---
.../hbase/filter/MultipleColumnPrefixFilter.java | 20 ++++---
.../apache/hadoop/hbase/filter/NullComparator.java | 19 +++---
.../org/apache/hadoop/hbase/filter/PageFilter.java | 10 ++--
.../apache/hadoop/hbase/filter/ParseFilter.java | 19 +++---
.../apache/hadoop/hbase/filter/PrefixFilter.java | 17 +++---
.../hadoop/hbase/filter/QualifierFilter.java | 16 +++--
.../hadoop/hbase/filter/RandomRowFilter.java | 20 ++++---
.../hadoop/hbase/filter/RegexStringComparator.java | 18 ++++--
.../org/apache/hadoop/hbase/filter/RowFilter.java | 18 ++++--
.../filter/SingleColumnValueExcludeFilter.java | 19 +++---
.../hbase/filter/SingleColumnValueFilter.java | 6 +-
.../org/apache/hadoop/hbase/filter/SkipFilter.java | 19 +++---
.../hadoop/hbase/filter/SubstringComparator.java | 19 +++---
.../hadoop/hbase/filter/TimestampsFilter.java | 16 +++--
.../apache/hadoop/hbase/filter/ValueFilter.java | 18 ++++--
.../hadoop/hbase/filter/WhileMatchFilter.java | 17 +++---
.../apache/hadoop/hbase/filter/package-info.java | 21 ++++---
.../apache/hadoop/hbase/ipc/AbstractRpcClient.java | 6 +-
.../hadoop/hbase/ipc/BlockingRpcConnection.java | 7 ++-
.../hbase/ipc/BufferCallBeforeInitHandler.java | 5 +-
.../apache/hadoop/hbase/ipc/CellBlockBuilder.java | 2 +
.../org/apache/hadoop/hbase/ipc/ConnectionId.java | 16 +++--
.../hadoop/hbase/ipc/HBaseRpcController.java | 2 +
.../apache/hadoop/hbase/ipc/NettyRpcClient.java | 3 +-
.../hadoop/hbase/ipc/NettyRpcConnection.java | 50 ++++++++--------
.../hadoop/hbase/ipc/NettyRpcDuplexHandler.java | 9 ++-
.../org/apache/hadoop/hbase/ipc/RpcClient.java | 4 +-
.../apache/hadoop/hbase/master/RegionState.java | 8 ++-
.../hadoop/hbase/protobuf/ProtobufMagic.java | 10 +---
.../apache/hadoop/hbase/protobuf/ProtobufUtil.java | 14 ++---
.../apache/hadoop/hbase/quotas/QuotaRetriever.java | 4 +-
.../hadoop/hbase/quotas/SpaceLimitSettings.java | 4 +-
.../hbase/replication/ReplicationLoadSink.java | 1 +
.../hbase/replication/ReplicationLoadSource.java | 1 +
.../NettyHBaseRpcConnectionHeaderHandler.java | 6 +-
.../org/apache/hadoop/hbase/security/SaslUtil.java | 10 ++--
.../hbase/security/access/AccessControlClient.java | 55 ++++++++++-------
.../hbase/security/access/AccessControlUtil.java | 17 ++----
.../security/access/ShadedAccessControlUtil.java | 14 ++---
.../hbase/security/access/TablePermission.java | 4 +-
.../security/visibility/VisibilityClient.java | 19 +++---
.../hadoop/hbase/shaded/protobuf/ProtobufUtil.java | 27 +++------
.../hbase/shaded/protobuf/RequestConverter.java | 11 ++--
.../org/apache/hadoop/hbase/util/Writables.java | 1 +
.../hadoop/hbase/zookeeper/ReadOnlyZKClient.java | 4 ++
.../apache/hadoop/hbase/zookeeper/ZKMetadata.java | 2 +-
.../apache/hadoop/hbase/TestHTableDescriptor.java | 6 +-
.../hadoop/hbase/client/TestAsyncProcess.java | 12 ++--
.../hbase/client/TestAsyncTableRpcPriority.java | 14 ++---
.../hadoop/hbase/client/TestAsyncTableTracing.java | 4 +-
.../hadoop/hbase/client/TestClientNoCluster.java | 18 +-----
.../hadoop/hbase/client/TestClientScanner.java | 25 ++++----
.../hbase/client/TestCoprocessorDescriptor.java | 4 --
.../org/apache/hadoop/hbase/client/TestGet.java | 3 +-
.../client/TestImmutableHTableDescriptor.java | 1 +
.../apache/hadoop/hbase/client/TestMutation.java | 10 ++--
.../hadoop/hbase/client/TestRegionInfoDisplay.java | 4 +-
.../org/apache/hadoop/hbase/client/TestScan.java | 33 ++++-------
.../hbase/client/TestSimpleRequestController.java | 12 ++--
.../hbase/client/TestTableDescriptorBuilder.java | 6 +-
.../hadoop/hbase/filter/TestKeyOnlyFilter.java | 4 +-
.../hadoop/hbase/ipc/TestCellBlockBuilder.java | 9 ++-
.../hadoop/hbase/ipc/TestNettyRpcConnection.java | 4 +-
.../quotas/TestQuotaGlobalsSettingsBypass.java | 1 +
.../hbase/security/TestHBaseSaslRpcClient.java | 29 ++++-----
.../hadoop/hbase/util/TestRoundRobinPoolMap.java | 6 +-
.../hadoop/hbase/util/TestThreadLocalPoolMap.java | 6 +-
180 files changed, 1193 insertions(+), 1081 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/AsyncMetaTableAccessor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/AsyncMetaTableAccessor.java
index 414d4ee7b49..813c060b520 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/AsyncMetaTableAccessor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/AsyncMetaTableAccessor.java
@@ -101,11 +101,7 @@ public class AsyncMetaTableAccessor {
return future;
}
- /**
- * Returns the HRegionLocation from meta for the given region n * @param regionName region we're
- * looking for
- * @return HRegionLocation for the given region
- */
+ /** Returns the HRegionLocation from meta for the given region */
public static CompletableFuture<Optional<HRegionLocation>>
getRegionLocation(AsyncTable<?> metaTable, byte[] regionName) {
CompletableFuture<Optional<HRegionLocation>> future = new CompletableFuture<>();
@@ -127,11 +123,7 @@ public class AsyncMetaTableAccessor {
return future;
}
- /**
- * Returns the HRegionLocation from meta for the given encoded region name n * @param
- * encodedRegionName region we're looking for
- * @return HRegionLocation for the given region
- */
+ /** Returns the HRegionLocation from meta for the given encoded region name */
public static CompletableFuture<Optional<HRegionLocation>>
getRegionLocationWithEncodedName(AsyncTable<?> metaTable, byte[] encodedRegionName) {
CompletableFuture<Optional<HRegionLocation>> future = new CompletableFuture<>();
@@ -176,8 +168,9 @@ public class AsyncMetaTableAccessor {
}
/**
- * Used to get all region locations for the specific table. n * @param tableName table we're
- * looking for, can be null for getting all regions
+ * Used to get all region locations for the specific table
+ * @param metaTable scanner over meta table
+ * @param tableName table we're looking for, can be null for getting all regions
* @return the list of region locations. The return value will be wrapped by a
* {@link CompletableFuture}.
*/
@@ -200,8 +193,9 @@ public class AsyncMetaTableAccessor {
}
/**
- * Used to get table regions' info and server. n * @param tableName table we're looking for, can
- * be null for getting all regions
+ * Used to get table regions' info and server.
+ * @param metaTable scanner over meta table
+ * @param tableName table we're looking for, can be null for getting all regions
* @param excludeOfflinedSplitParents don't return split parents
* @return the list of regioninfos and server. The return value will be wrapped by a
* {@link CompletableFuture}.
@@ -259,9 +253,11 @@ public class AsyncMetaTableAccessor {
}
/**
- * Performs a scan of META table for given table. n * @param tableName table withing we scan
- * @param type scanned part of meta
- * @param visitor Visitor invoked against each row
+ * Performs a scan of META table for given table.
+ * @param metaTable scanner over meta table
+ * @param tableName table within we scan
+ * @param type scanned part of meta
+ * @param visitor Visitor invoked against each row
*/
private static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable,
TableName tableName, QueryType type, final Visitor visitor) {
@@ -270,11 +266,13 @@ public class AsyncMetaTableAccessor {
}
/**
- * Performs a scan of META table for given table. n * @param startRow Where to start the scan
- * @param stopRow Where to stop the scan
- * @param type scanned part of meta
- * @param maxRows maximum rows to return
- * @param visitor Visitor invoked against each row
+ * Performs a scan of META table for given table.
+ * @param metaTable scanner over meta table
+ * @param startRow Where to start the scan
+ * @param stopRow Where to stop the scan
+ * @param type scanned part of meta
+ * @param maxRows maximum rows to return
+ * @param visitor Visitor invoked against each row
*/
private static CompletableFuture<Void> scanMeta(AsyncTable<AdvancedScanResultConsumer> metaTable,
byte[] startRow, byte[] stopRow, QueryType type, int maxRows, final Visitor visitor) {
@@ -410,9 +408,13 @@ public class AsyncMetaTableAccessor {
* can't deserialize the result.
*/
private static Optional<RegionLocations> getRegionLocations(final Result r) {
- if (r == null) return Optional.empty();
+ if (r == null) {
+ return Optional.empty();
+ }
Optional<RegionInfo> regionInfo = getHRegionInfo(r, getRegionInfoColumn());
- if (!regionInfo.isPresent()) return Optional.empty();
+ if (!regionInfo.isPresent()) {
+ return Optional.empty();
+ }
List<HRegionLocation> locations = new ArrayList<HRegionLocation>(1);
NavigableMap<byte[], NavigableMap<byte[], byte[]>> familyMap = r.getNoVersionMap();
@@ -420,15 +422,18 @@ public class AsyncMetaTableAccessor {
locations.add(getRegionLocation(r, regionInfo.get(), 0));
NavigableMap<byte[], byte[]> infoMap = familyMap.get(getCatalogFamily());
- if (infoMap == null) return Optional.of(new RegionLocations(locations));
+ if (infoMap == null) {
+ return Optional.of(new RegionLocations(locations));
+ }
// iterate until all serverName columns are seen
int replicaId = 0;
byte[] serverColumn = getServerColumn(replicaId);
- SortedMap<byte[], byte[]> serverMap = null;
- serverMap = infoMap.tailMap(serverColumn, false);
+ SortedMap<byte[], byte[]> serverMap = infoMap.tailMap(serverColumn, false);
- if (serverMap.isEmpty()) return Optional.of(new RegionLocations(locations));
+ if (serverMap.isEmpty()) {
+ return Optional.of(new RegionLocations(locations));
+ }
for (Map.Entry<byte[], byte[]> entry : serverMap.entrySet()) {
replicaId = parseReplicaIdFromServerColumn(entry.getKey());
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterId.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterId.java
index 9b7a5de19bd..8c675c4522e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterId.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterId.java
@@ -51,6 +51,7 @@ public class ClusterId {
}
/**
+ * Parse the serialized representation of the {@link ClusterId}
* @param bytes A pb serialized {@link ClusterId} instance with pb magic prefix
* @return An instance of {@link ClusterId} made from <code>bytes</code> n * @see #toByteArray()
*/
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterMetricsBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterMetricsBuilder.java
index 7ef8a208611..630e3620a67 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterMetricsBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterMetricsBuilder.java
@@ -67,11 +67,11 @@ public final class ClusterMetricsBuilder {
.collect(Collectors.toList()))
.addAllTableRegionStatesCount(metrics.getTableRegionStatesCount().entrySet().stream()
.map(status -> ClusterStatusProtos.TableRegionStatesCount.newBuilder()
- .setTableName(ProtobufUtil.toProtoTableName((status.getKey())))
+ .setTableName(ProtobufUtil.toProtoTableName(status.getKey()))
.setRegionStatesCount(ProtobufUtil.toTableRegionStatesCount(status.getValue())).build())
.collect(Collectors.toList()));
if (metrics.getMasterName() != null) {
- builder.setMaster(ProtobufUtil.toServerName((metrics.getMasterName())));
+ builder.setMaster(ProtobufUtil.toServerName(metrics.getMasterName()));
}
if (metrics.getMasterTasks() != null) {
builder.addAllMasterTasks(metrics.getMasterTasks().stream()
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java
index e218437694b..e3b1a8ab662 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java
@@ -186,6 +186,7 @@ public class ClusterStatus implements ClusterMetrics {
}
/** Returns the HBase version string as reported by the HMaster */
+ @Override
public String getHBaseVersion() {
return metrics.getHBaseVersion();
}
@@ -279,6 +280,7 @@ public class ClusterStatus implements ClusterMetrics {
return serverMetrics == null ? null : new ServerLoad(serverMetrics);
}
+ @Override
public String getClusterId() {
return metrics.getClusterId();
}
@@ -289,6 +291,7 @@ public class ClusterStatus implements ClusterMetrics {
}
/**
+ * Get the list of master coprocessor names.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
* {@link #getMasterCoprocessorNames} instead.
*/
@@ -299,6 +302,7 @@ public class ClusterStatus implements ClusterMetrics {
}
/**
+ * Get the last major compaction time for a given table.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
* {@link #getLastMajorCompactionTimestamp(TableName)} instead.
*/
@@ -308,6 +312,7 @@ public class ClusterStatus implements ClusterMetrics {
}
/**
+ * Get the last major compaction time for a given region.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
* {@link #getLastMajorCompactionTimestamp(byte[])} instead.
*/
@@ -317,6 +322,7 @@ public class ClusterStatus implements ClusterMetrics {
}
/**
+ * Returns true if the balancer is enabled.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 No flag in 2.0
*/
@Deprecated
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java
index 94909f1c14e..32e06d61024 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java
@@ -44,8 +44,8 @@ public interface CoprocessorEnvironment<C extends Coprocessor> {
int getLoadSequence();
/**
- * @return a Read-only Configuration; throws {@link UnsupportedOperationException} if you try to
- * set a configuration.
+ * Returns a Read-only Configuration; throws {@link UnsupportedOperationException} if you try to
+ * set a configuration.
*/
Configuration getConfiguration();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HBaseServerException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HBaseServerException.java
index 3484995c1bf..47a86f9492f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HBaseServerException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HBaseServerException.java
@@ -44,10 +44,7 @@ public class HBaseServerException extends HBaseIOException {
this.serverOverloaded = serverOverloaded;
}
- /**
- * @param t throwable to check for server overloaded state
- * @return True if the server was considered overloaded when the exception was thrown
- */
+ /** Returns True if the server was considered overloaded when the exception was thrown */
public static boolean isServerOverloaded(Throwable t) {
if (t instanceof HBaseServerException) {
return ((HBaseServerException) t).isServerOverloaded();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
index d55b417d482..43640858ccc 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
@@ -176,6 +176,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Check if a given family name is allowed.
* @param b Family name.
* @return <code>b</code>
* @throws IllegalArgumentException If not null and not a legitimate family name: i.e. 'printable'
@@ -205,19 +206,12 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
return delegatee.getNameAsString();
}
- /**
- * @param key The key.
- * @return The value.
- */
@Override
public byte[] getValue(byte[] key) {
return delegatee.getValue(key);
}
- /**
- * @param key The key.
- * @return The value as a string.
- */
+ @Override
public String getValue(String key) {
byte[] value = getValue(Bytes.toBytes(key));
return value == null ? null : Bytes.toString(value);
@@ -228,35 +222,22 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
return delegatee.getValues();
}
- /**
- * @param key The key.
- * @param value The value.
- * @return this (for chained invocation)
- */
public HColumnDescriptor setValue(byte[] key, byte[] value) {
getDelegateeForModification().setValue(key, value);
return this;
}
- /**
- * @param key Key whose key and value we're to remove from HCD parameters.
- */
public void remove(final byte[] key) {
getDelegateeForModification().removeValue(new Bytes(key));
}
- /**
- * @param key The key.
- * @param value The value.
- * @return this (for chained invocation)
- */
public HColumnDescriptor setValue(String key, String value) {
getDelegateeForModification().setValue(key, value);
return this;
}
/**
- * @return compression type being used for the column family
+ * Returns compression type being used for the column family
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13655">HBASE-13655</a>). Use
* {@link #getCompressionType()}.
@@ -267,7 +248,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
- * @return compression type being used for the column family for major compaction
+ * Returns compression type being used for the column family for major compaction
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13655">HBASE-13655</a>). Use
* {@link #getCompactionCompressionType()}.
@@ -283,6 +264,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set maximum versions to keep
* @param value maximum number of versions
* @return this (for chained invocation)
*/
@@ -320,6 +302,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set block size to use when writing
* @param value Blocksize to use when writing out storefiles/hfiles on this column family.
* @return this (for chained invocation)
*/
@@ -423,6 +406,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set or clear the in memory flag.
* @param value True if we are to favor keeping all values for this column family in the
* HRegionServer cache
* @return this (for chained invocation)
@@ -438,6 +422,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set the in memory compaction policy.
* @param value the prefered in-memory compaction policy for this column family
* @return this (for chained invocation)
*/
@@ -452,6 +437,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set the keep deleted cells policy.
* @param value True if deleted rows should not be collected immediately.
* @return this (for chained invocation)
*/
@@ -481,6 +467,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set the time to live of cell contents
* @param value Time-to-live of cell contents, in seconds.
* @return this (for chained invocation)
*/
@@ -490,6 +477,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set the time to live of cell contents
* @param value Time to live of cell contents, in human readable format
* @see org.apache.hadoop.hbase.util.PrettyPrinter#format(String, Unit)
* @return this (for chained invocation)
@@ -505,6 +493,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set the minimum number of versions to keep.
* @param value The minimum number of versions to keep. (used when timeToLive is set)
* @return this (for chained invocation)
*/
@@ -519,6 +508,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set or clear the block cache enabled flag.
* @param value True if hfile DATA type blocks should be cached (We always cache INDEX and BLOOM
* blocks; you cannot turn this off).
* @return this (for chained invocation)
@@ -534,6 +524,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set the bloom filter type.
* @param value bloom filter type
* @return this (for chained invocation)
*/
@@ -547,10 +538,6 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
return delegatee.getScope();
}
- /**
- * @param value the scope tag
- * @return this (for chained invocation)
- */
public HColumnDescriptor setScope(int value) {
getDelegateeForModification().setScope(value);
return this;
@@ -562,6 +549,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set or clear the cache data on write flag.
* @param value true if we should cache data blocks on write
* @return this (for chained invocation)
*/
@@ -571,7 +559,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
- * This is a noop call from HBase 2.0 onwards
+ * Set or clear the cache in L1 flag. This is a noop call from HBase 2.0 onwards
* @return this (for chained invocation)
* @deprecated Since 2.0 and will be removed in 3.0 with out any replacement. Caching data in on
* heap Cache, when there are both on heap LRU Cache and Bucket Cache will no longer
@@ -588,6 +576,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set or clear the cache indexes on write flag.
* @param value true if we should cache index blocks on write
* @return this (for chained invocation)
*/
@@ -602,6 +591,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set or clear the cache bloom filters on write flag.
* @param value true if we should cache bloomfilter blocks on write
* @return this (for chained invocation)
*/
@@ -616,6 +606,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set or clear the evict bloom filters on close flag.
* @param value true if we should evict cached blocks from the blockcache on close
* @return this (for chained invocation)
*/
@@ -630,6 +621,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Set or clear the prefetch on open flag.
* @param value true if we should prefetch blocks into the blockcache on open
* @return this (for chained invocation)
*/
@@ -638,9 +630,6 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
return this;
}
- /**
- * @see java.lang.Object#toString()
- */
@Override
public String toString() {
return delegatee.toString();
@@ -660,9 +649,6 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
return ColumnFamilyDescriptorBuilder.getDefaultValues();
}
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -674,9 +660,6 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
return false;
}
- /**
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode() {
return delegatee.hashCode();
@@ -688,7 +671,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
- * @return This instance serialized with pb with pb magic prefix
+ * Returns This instance serialized with pb with pb magic prefix
* @see #parseFrom(byte[])
*/
public byte[] toByteArray() {
@@ -696,6 +679,7 @@ public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HCo
}
/**
+ * Parse a serialized representation of a {@link HColumnDescriptor}
* @param bytes A pb serialized {@link HColumnDescriptor} instance with pb magic prefix
* @return An instance of {@link HColumnDescriptor} made from <code>bytes</code> n * @see
* #toByteArray()
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
index 5e9abd31a7e..2f4d6377888 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
@@ -221,7 +221,7 @@ public class HRegionInfo implements RegionInfo {
/**
* Construct HRegionInfo with explicit parameters
- * @param tableName the table descriptor
+ * @param tableName the table name
* @param startKey first key in region
* @param endKey end of key range
* @param split true if this region has split and we have daughter regions regions that may or
@@ -234,37 +234,37 @@ public class HRegionInfo implements RegionInfo {
/**
* Construct HRegionInfo with explicit parameters
- * @param tableName the table descriptor
+ * @param tableName the table name
* @param startKey first key in region
* @param endKey end of key range
* @param split true if this region has split and we have daughter regions regions that may or
* may not hold references to this region.
- * @param regionid Region id to use. n
+ * @param regionId Region id to use.
*/
public HRegionInfo(final TableName tableName, final byte[] startKey, final byte[] endKey,
- final boolean split, final long regionid) throws IllegalArgumentException {
- this(tableName, startKey, endKey, split, regionid, DEFAULT_REPLICA_ID);
+ final boolean split, final long regionId) throws IllegalArgumentException {
+ this(tableName, startKey, endKey, split, regionId, DEFAULT_REPLICA_ID);
}
/**
* Construct HRegionInfo with explicit parameters
- * @param tableName the table descriptor
+ * @param tableName the table name
* @param startKey first key in region
* @param endKey end of key range
* @param split true if this region has split and we have daughter regions regions that may or
* may not hold references to this region.
- * @param regionid Region id to use.
- * @param replicaId the replicaId to use n
+ * @param regionId Region id to use.
+ * @param replicaId the replicaId to use
*/
public HRegionInfo(final TableName tableName, final byte[] startKey, final byte[] endKey,
- final boolean split, final long regionid, final int replicaId) throws IllegalArgumentException {
+ final boolean split, final long regionId, final int replicaId) throws IllegalArgumentException {
super();
if (tableName == null) {
throw new IllegalArgumentException("TableName cannot be null");
}
this.tableName = tableName;
this.offLine = false;
- this.regionId = regionid;
+ this.regionId = regionId;
this.replicaId = replicaId;
if (this.replicaId > MAX_REPLICA_ID) {
throw new IllegalArgumentException("ReplicaId cannot be greater than" + MAX_REPLICA_ID);
@@ -280,7 +280,7 @@ public class HRegionInfo implements RegionInfo {
}
/**
- * Costruct a copy of another HRegionInfo n
+ * Construct a copy of another HRegionInfo
*/
public HRegionInfo(RegionInfo other) {
super();
@@ -303,8 +303,10 @@ public class HRegionInfo implements RegionInfo {
}
/**
- * Make a region name of passed parameters. n * @param startKey Can be null
- * @param regionid Region id (Usually timestamp from when region was created).
+ * Make a region name of passed parameters.
+ * @param tableName the table name
+ * @param startKey Can be null
+ * @param regionId Region id (Usually timestamp from when region was created).
* @param newFormat should we create the region name in the new format (such that it contains its
* encoded name?).
* @return Region name made of passed tableName, startKey and id
@@ -314,12 +316,14 @@ public class HRegionInfo implements RegionInfo {
@Deprecated
@InterfaceAudience.Private
public static byte[] createRegionName(final TableName tableName, final byte[] startKey,
- final long regionid, boolean newFormat) {
- return RegionInfo.createRegionName(tableName, startKey, Long.toString(regionid), newFormat);
+ final long regionId, boolean newFormat) {
+ return RegionInfo.createRegionName(tableName, startKey, Long.toString(regionId), newFormat);
}
/**
- * Make a region name of passed parameters. n * @param startKey Can be null
+ * Make a region name of passed parameters.
+ * @param tableName the table name
+ * @param startKey Can be null
* @param id Region id (Usually timestamp from when region was created).
* @param newFormat should we create the region name in the new format (such that it contains its
* encoded name?).
@@ -335,10 +339,12 @@ public class HRegionInfo implements RegionInfo {
}
/**
- * Make a region name of passed parameters. n * @param startKey Can be null
- * @param regionid Region id (Usually timestamp from when region was created). n * @param
- * newFormat should we create the region name in the new format (such that it
- * contains its encoded name?).
+ * Make a region name of passed parameters.
+ * @param tableName the table name
+ * @param startKey Can be null
+ * @param regionId Region id (Usually timestamp from when region was created).
+ * @param newFormat should we create the region name in the new format (such that it contains its
+ * encoded name?).
* @return Region name made of passed tableName, startKey, id and replicaId
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
* {@link RegionInfo#createRegionName(TableName, byte[], long, int, boolean)}.
@@ -346,13 +352,15 @@ public class HRegionInfo implements RegionInfo {
@Deprecated
@InterfaceAudience.Private
public static byte[] createRegionName(final TableName tableName, final byte[] startKey,
- final long regionid, int replicaId, boolean newFormat) {
- return RegionInfo.createRegionName(tableName, startKey, Bytes.toBytes(Long.toString(regionid)),
+ final long regionId, int replicaId, boolean newFormat) {
+ return RegionInfo.createRegionName(tableName, startKey, Bytes.toBytes(Long.toString(regionId)),
replicaId, newFormat);
}
/**
- * Make a region name of passed parameters. n * @param startKey Can be null
+ * Make a region name of passed parameters.
+ * @param tableName the table name
+ * @param startKey Can be null
* @param id Region id (Usually timestamp from when region was created).
* @param newFormat should we create the region name in the new format (such that it contains its
* encoded name?).
@@ -368,9 +376,11 @@ public class HRegionInfo implements RegionInfo {
}
/**
- * Make a region name of passed parameters. n * @param startKey Can be null
- * @param id Region id (Usually timestamp from when region was created). n * @param newFormat
- * should we create the region name in the new format
+ * Make a region name of passed parameters.
+ * @param tableName the table name
+ * @param startKey Can be null
+ * @param id Region id (Usually timestamp from when region was created)
+ * @param newFormat should we create the region name in the new format
* @return Region name made of passed tableName, startKey, id and replicaId
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
* {@link RegionInfo#createRegionName(TableName, byte[], byte[], int, boolean)}.
@@ -546,6 +556,7 @@ public class HRegionInfo implements RegionInfo {
}
/**
+ * Set or clear the split status flag.
* @param split set split status
*/
public void setSplit(boolean split) {
@@ -684,6 +695,7 @@ public class HRegionInfo implements RegionInfo {
}
/**
+ * Serialize a {@link HRegionInfo} into a byte array.
* @return This instance serialized as protobuf w/ a magic pb prefix.
* @see #parseFrom(byte[])
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
@@ -695,6 +707,7 @@ public class HRegionInfo implements RegionInfo {
}
/**
+ * Parse a serialized representation of a {@link HRegionInfo}.
* @return A deserialized {@link HRegionInfo} or null if we failed deserialize or passed bytes
* null
* @see #toByteArray()
@@ -708,6 +721,7 @@ public class HRegionInfo implements RegionInfo {
}
/**
+ * Parse a serialized representation of a {@link HRegionInfo}.
* @return A deserialized {@link HRegionInfo} or null if we failed deserialize or passed bytes
* null
* @see #toByteArray()
@@ -725,6 +739,7 @@ public class HRegionInfo implements RegionInfo {
}
/**
+ * Parse a serialized representation of a {@link HRegionInfo}.
* @param bytes A pb RegionInfo serialized with a pb magic prefix.
* @return A deserialized {@link HRegionInfo} n * @see #toByteArray()
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 Use
@@ -736,6 +751,7 @@ public class HRegionInfo implements RegionInfo {
}
/**
+ * Parse a serialized representation of a {@link HRegionInfo}.
* @param bytes A pb RegionInfo serialized with a pb magic prefix.
* @param offset starting point in the byte array
* @param len length to read on the byte array
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java
index 6ae93bb3954..a7720b2734e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java
@@ -110,8 +110,8 @@ public class HRegionLocation implements Comparable<HRegionLocation> {
}
/**
- * @return String made of hostname and port formatted as per
- * {@link Addressing#createHostAndPortStr(String, int)}
+ * Returns String made of hostname and port formatted as per
+ * {@link Addressing#createHostAndPortStr(String, int)}
*/
public String getHostnamePort() {
return Addressing.createHostAndPortStr(this.getHostname(), this.getPort());
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
index 6c8ea810d03..f5448e61737 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
@@ -801,6 +801,7 @@ public class HTableDescriptor implements TableDescriptor, Comparable<HTableDescr
new HTableDescriptor(TableDescriptorBuilder.NAMESPACE_TABLEDESC);
/**
+ * Set the table owner.
* @deprecated since 0.94.1
* @see <a href="https://issues.apache.org/jira/browse/HBASE-6188">HBASE-6188</a>
*/
@@ -811,6 +812,7 @@ public class HTableDescriptor implements TableDescriptor, Comparable<HTableDescr
}
/**
+ * Set the table owner.
* @deprecated since 0.94.1
* @see <a href="https://issues.apache.org/jira/browse/HBASE-6188">HBASE-6188</a>
*/
@@ -822,6 +824,7 @@ public class HTableDescriptor implements TableDescriptor, Comparable<HTableDescr
}
/**
+ * Get the table owner.
* @deprecated since 0.94.1
* @see <a href="https://issues.apache.org/jira/browse/HBASE-6188">HBASE-6188</a>
*/
@@ -832,14 +835,14 @@ public class HTableDescriptor implements TableDescriptor, Comparable<HTableDescr
}
/**
- * @return This instance serialized with pb with pb magic prefix
- * @see #parseFrom(byte[])
+ * Returns This instance serialized with pb with pb magic prefix
*/
public byte[] toByteArray() {
return TableDescriptorBuilder.toByteArray(delegatee);
}
/**
+ * Parse the serialized representation of a {@link HTableDescriptor}
* @param bytes A pb serialized {@link HTableDescriptor} instance with pb magic prefix
* @return An instance of {@link HTableDescriptor} made from <code>bytes</code> nn * @see
* #toByteArray()
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
index 01b5f49a205..48476e4bb3a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
@@ -38,7 +38,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.Cell.Type;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.Consistency;
import org.apache.hadoop.hbase.client.Delete;
@@ -155,6 +154,7 @@ public class MetaTableAccessor {
private static final byte SEPARATED_BYTE = 0x00;
@InterfaceAudience.Private
+ @SuppressWarnings("ImmutableEnumChecker")
public enum QueryType {
ALL(HConstants.TABLE_FAMILY, HConstants.CATALOG_FAMILY),
REGION(HConstants.CATALOG_FAMILY),
@@ -364,8 +364,8 @@ public class MetaTableAccessor {
}
/**
- * @return Return all regioninfos listed in the 'info:merge*' columns of the
- * <code>regionName</code> row.
+ * Returns Return all regioninfos listed in the 'info:merge*' columns of the
+ * <code>regionName</code> row.
*/
@Nullable
public static List<RegionInfo> getMergeRegions(Connection connection, byte[] regionName)
@@ -381,8 +381,8 @@ public class MetaTableAccessor {
}
/**
- * @return Deserialized values of <qualifier,regioninfo> pairs taken from column values that
- * match the regex 'info:merge.*' in array of <code>cells</code>.
+ * Returns Deserialized values of <qualifier,regioninfo> pairs taken from column values that
+ * match the regex 'info:merge.*' in array of <code>cells</code>.
*/
@Nullable
public static Map<String, RegionInfo> getMergeRegionsWithName(Cell[] cells) {
@@ -408,8 +408,8 @@ public class MetaTableAccessor {
}
/**
- * @return Deserialized regioninfo values taken from column values that match the regex
- * 'info:merge.*' in array of <code>cells</code>.
+ * Returns Deserialized regioninfo values taken from column values that match the regex
+ * 'info:merge.*' in array of <code>cells</code>.
*/
@Nullable
public static List<RegionInfo> getMergeRegions(Cell[] cells) {
@@ -418,8 +418,8 @@ public class MetaTableAccessor {
}
/**
- * @return True if any merge regions present in <code>cells</code>; i.e. the column in
- * <code>cell</code> matches the regex 'info:merge.*'.
+ * Returns True if any merge regions present in <code>cells</code>; i.e. the column in
+ * <code>cell</code> matches the regex 'info:merge.*'.
*/
public static boolean hasMergeRegions(Cell[] cells) {
for (Cell cell : cells) {
@@ -483,6 +483,7 @@ public class MetaTableAccessor {
return getListOfRegionInfos(result);
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private static List<RegionInfo>
getListOfRegionInfos(final List<Pair<RegionInfo, ServerName>> pairs) {
if (pairs == null || pairs.isEmpty()) {
@@ -496,8 +497,7 @@ public class MetaTableAccessor {
}
/**
- * @param tableName table we're working with
- * @return start row for scanning META according to query type
+ * Returns start row for scanning META according to query type
*/
public static byte[] getTableStartRowForMeta(TableName tableName, QueryType type) {
if (tableName == null) {
@@ -518,8 +518,7 @@ public class MetaTableAccessor {
}
/**
- * @param tableName table we're working with
- * @return stop row for scanning META according to query type
+ * Returns stop row for scanning META according to query type
*/
public static byte[] getTableStopRowForMeta(TableName tableName, QueryType type) {
if (tableName == null) {
@@ -641,9 +640,10 @@ public class MetaTableAccessor {
}
/**
+ * Get the user regions a given server is hosting.
* @param connection connection we're using
* @param serverName server whose regions we're interested in
- * @return List of user regions installed on this server (does not include catalog regions). n
+ * @return List of user regions installed on this server (does not include catalog regions).
*/
public static NavigableMap<RegionInfo, Result> getServerUserRegions(Connection connection,
final ServerName serverName) throws IOException {
@@ -1284,7 +1284,7 @@ public class MetaTableAccessor {
if (info == null) {
return true;
}
- if (!(info.getTable().equals(tableName))) {
+ if (!info.getTable().equals(tableName)) {
return false;
}
return super.visit(rowResult);
@@ -1321,14 +1321,14 @@ public class MetaTableAccessor {
if (splitA != null) {
put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(put.getRow())
.setFamily(HConstants.CATALOG_FAMILY).setQualifier(HConstants.SPLITA_QUALIFIER)
- .setTimestamp(put.getTimestamp()).setType(Type.Put).setValue(RegionInfo.toByteArray(splitA))
- .build());
+ .setTimestamp(put.getTimestamp()).setType(Cell.Type.Put)
+ .setValue(RegionInfo.toByteArray(splitA)).build());
}
if (splitB != null) {
put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(put.getRow())
.setFamily(HConstants.CATALOG_FAMILY).setQualifier(HConstants.SPLITB_QUALIFIER)
- .setTimestamp(put.getTimestamp()).setType(Type.Put).setValue(RegionInfo.toByteArray(splitB))
- .build());
+ .setTimestamp(put.getTimestamp()).setType(Cell.Type.Put)
+ .setValue(RegionInfo.toByteArray(splitB)).build());
}
return put;
}
@@ -1509,8 +1509,8 @@ public class MetaTableAccessor {
String qualifier = String.format(HConstants.MERGE_QUALIFIER_PREFIX_STR + "%04d", counter++);
put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(put.getRow())
.setFamily(HConstants.CATALOG_FAMILY).setQualifier(Bytes.toBytes(qualifier))
- .setTimestamp(put.getTimestamp()).setType(Type.Put).setValue(RegionInfo.toByteArray(ri))
- .build());
+ .setTimestamp(put.getTimestamp()).setType(Cell.Type.Put)
+ .setValue(RegionInfo.toByteArray(ri)).build());
}
return put;
}
@@ -1852,7 +1852,7 @@ public class MetaTableAccessor {
public static Put addRegionInfo(final Put p, final RegionInfo hri) throws IOException {
p.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(p.getRow())
.setFamily(getCatalogFamily()).setQualifier(HConstants.REGIONINFO_QUALIFIER)
- .setTimestamp(p.getTimestamp()).setType(Type.Put)
+ .setTimestamp(p.getTimestamp()).setType(Cell.Type.Put)
// Serialize the Default Replica HRI otherwise scan of hbase:meta
// shows an info:regioninfo value with encoded name and region
// name that differs from that of the hbase;meta row.
@@ -1872,8 +1872,8 @@ public class MetaTableAccessor {
.setQualifier(getStartCodeColumn(replicaId)).setTimestamp(p.getTimestamp())
.setType(Cell.Type.Put).setValue(Bytes.toBytes(sn.getStartcode())).build())
.add(builder.clear().setRow(p.getRow()).setFamily(getCatalogFamily())
- .setQualifier(getSeqNumColumn(replicaId)).setTimestamp(p.getTimestamp()).setType(Type.Put)
- .setValue(Bytes.toBytes(openSeqNum)).build());
+ .setQualifier(getSeqNumColumn(replicaId)).setTimestamp(p.getTimestamp())
+ .setType(Cell.Type.Put).setValue(Bytes.toBytes(openSeqNum)).build());
}
private static void writeRegionName(ByteArrayOutputStream out, byte[] regionName) {
@@ -1922,7 +1922,7 @@ public class MetaTableAccessor {
byte[] value = getParentsBytes(parents);
put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(put.getRow())
.setFamily(HConstants.REPLICATION_BARRIER_FAMILY).setQualifier(REPLICATION_PARENT_QUALIFIER)
- .setTimestamp(put.getTimestamp()).setType(Type.Put).setValue(value).build());
+ .setTimestamp(put.getTimestamp()).setType(Cell.Type.Put).setValue(value).build());
}
public static Put makePutForReplicationBarrier(RegionInfo regionInfo, long openSeqNum, long ts)
@@ -1938,7 +1938,7 @@ public class MetaTableAccessor {
public static void addReplicationBarrier(Put put, long openSeqNum) throws IOException {
put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(put.getRow())
.setFamily(HConstants.REPLICATION_BARRIER_FAMILY).setQualifier(HConstants.SEQNUM_QUALIFIER)
- .setTimestamp(put.getTimestamp()).setType(Type.Put).setValue(Bytes.toBytes(openSeqNum))
+ .setTimestamp(put.getTimestamp()).setType(Cell.Type.Put).setValue(Bytes.toBytes(openSeqNum))
.build());
}
@@ -1946,8 +1946,8 @@ public class MetaTableAccessor {
CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
return p
.add(builder.clear().setRow(p.getRow()).setFamily(getCatalogFamily())
- .setQualifier(getServerColumn(replicaId)).setTimestamp(p.getTimestamp()).setType(Type.Put)
- .build())
+ .setQualifier(getServerColumn(replicaId)).setTimestamp(p.getTimestamp())
+ .setType(Cell.Type.Put).build())
.add(builder.clear().setRow(p.getRow()).setFamily(getCatalogFamily())
.setQualifier(getStartCodeColumn(replicaId)).setTimestamp(p.getTimestamp())
.setType(Cell.Type.Put).build())
@@ -2096,7 +2096,7 @@ public class MetaTableAccessor {
private static Put addSequenceNum(Put p, long openSeqNum, int replicaId) throws IOException {
return p.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(p.getRow())
.setFamily(HConstants.CATALOG_FAMILY).setQualifier(getSeqNumColumn(replicaId))
- .setTimestamp(p.getTimestamp()).setType(Type.Put).setValue(Bytes.toBytes(openSeqNum))
+ .setTimestamp(p.getTimestamp()).setType(Cell.Type.Put).setValue(Bytes.toBytes(openSeqNum))
.build());
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java
index 0a762bf78a6..b45171e6495 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java
@@ -354,6 +354,7 @@ public class RegionLoad implements RegionMetrics {
}
/** Returns the reference count for the stores of this region */
+ @Override
public int getStoreRefCount() {
return metrics.getStoreRefCount();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLocations.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLocations.java
index 4d6dd6d43fa..4c0390c6c3b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLocations.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLocations.java
@@ -208,6 +208,7 @@ public class RegionLocations implements Iterable<HRegionLocation> {
* @param other the locations to merge with
* @return an RegionLocations object with merged locations or the same object if nothing is merged
*/
+ @SuppressWarnings("ReferenceEquality")
public RegionLocations mergeLocations(RegionLocations other) {
assert other != null;
@@ -280,6 +281,7 @@ public class RegionLocations implements Iterable<HRegionLocation> {
* @return an RegionLocations object with updated locations or the same object if nothing is
* updated
*/
+ @SuppressWarnings("ReferenceEquality")
public RegionLocations updateLocation(HRegionLocation location, boolean checkForEquals,
boolean force) {
assert location != null;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionMetrics.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionMetrics.java
index 645a31a8552..d915e7a32ca 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionMetrics.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionMetrics.java
@@ -107,8 +107,8 @@ public interface RegionMetrics {
int getStoreRefCount();
/**
- * @return the max reference count for any store file among all compacted stores files of this
- * region
+ * Returns the max reference count for any store file among all compacted stores files of this
+ * region
*/
int getMaxCompactedStoreFileRefCount();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java
index 2320c8e908e..714a1412553 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java
@@ -79,16 +79,17 @@ public class ServerLoad implements ServerMetrics {
for (RegionMetrics rl : metrics.getRegionMetrics().values()) {
stores += rl.getStoreCount();
storefiles += rl.getStoreFileCount();
- storeUncompressedSizeMB += rl.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
- storefileSizeMB += rl.getStoreFileSize().get(Size.Unit.MEGABYTE);
- memstoreSizeMB += rl.getMemStoreSize().get(Size.Unit.MEGABYTE);
+ storeUncompressedSizeMB += (int) rl.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
+ storefileSizeMB += (int) rl.getStoreFileSize().get(Size.Unit.MEGABYTE);
+ memstoreSizeMB += (int) rl.getMemStoreSize().get(Size.Unit.MEGABYTE);
readRequestsCount += rl.getReadRequestCount();
filteredReadRequestsCount += rl.getFilteredReadRequestCount();
writeRequestsCount += rl.getWriteRequestCount();
- storefileIndexSizeKB += rl.getStoreFileIndexSize().get(Size.Unit.KILOBYTE);
- rootIndexSizeKB += rl.getStoreFileRootLevelIndexSize().get(Size.Unit.KILOBYTE);
- totalStaticIndexSizeKB += rl.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE);
- totalStaticBloomSizeKB += rl.getBloomFilterSize().get(Size.Unit.KILOBYTE);
+ storefileIndexSizeKB += (long) rl.getStoreFileIndexSize().get(Size.Unit.KILOBYTE);
+ rootIndexSizeKB += (int) rl.getStoreFileRootLevelIndexSize().get(Size.Unit.KILOBYTE);
+ totalStaticIndexSizeKB +=
+ (int) rl.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE);
+ totalStaticBloomSizeKB += (int) rl.getBloomFilterSize().get(Size.Unit.KILOBYTE);
totalCompactingKVs += rl.getCompactingCellCount();
currentCompactedKVs += rl.getCompactedCellCount();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerMetricsBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerMetricsBuilder.java
index 72f78220c1a..1e57857db69 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerMetricsBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerMetricsBuilder.java
@@ -44,10 +44,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
@InterfaceAudience.Private
public final class ServerMetricsBuilder {
- /**
- * @param sn the server name
- * @return a empty metrics
- */
public static ServerMetrics of(ServerName sn) {
return newBuilder(sn).build();
}
@@ -280,6 +276,7 @@ public final class ServerMetricsBuilder {
return versionNumber;
}
+ @Override
public String getVersion() {
return version;
}
@@ -383,15 +380,17 @@ public final class ServerMetricsBuilder {
int currentMaxCompactedStoreFileRefCount = r.getMaxCompactedStoreFileRefCount();
maxCompactedStoreFileRefCount =
Math.max(maxCompactedStoreFileRefCount, currentMaxCompactedStoreFileRefCount);
- uncompressedStoreFileSizeMB += r.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
- storeFileSizeMB += r.getStoreFileSize().get(Size.Unit.MEGABYTE);
- memStoreSizeMB += r.getMemStoreSize().get(Size.Unit.MEGABYTE);
- storefileIndexSizeKB += r.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE);
+ uncompressedStoreFileSizeMB +=
+ (long) r.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
+ storeFileSizeMB += (long) r.getStoreFileSize().get(Size.Unit.MEGABYTE);
+ memStoreSizeMB += (long) r.getMemStoreSize().get(Size.Unit.MEGABYTE);
+ storefileIndexSizeKB +=
+ (long) r.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE);
readRequestsCount += r.getReadRequestCount();
writeRequestsCount += r.getWriteRequestCount();
filteredReadRequestsCount += r.getFilteredReadRequestCount();
- rootLevelIndexSizeKB += r.getStoreFileRootLevelIndexSize().get(Size.Unit.KILOBYTE);
- bloomFilterSizeMB += r.getBloomFilterSize().get(Size.Unit.MEGABYTE);
+ rootLevelIndexSizeKB += (long) r.getStoreFileRootLevelIndexSize().get(Size.Unit.KILOBYTE);
+ bloomFilterSizeMB += (long) r.getBloomFilterSize().get(Size.Unit.MEGABYTE);
compactedCellCount += r.getCompactedCellCount();
compactingCellCount += r.getCompactingCellCount();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/UserMetrics.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/UserMetrics.java
index 05108c70e74..681b1f416c7 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/UserMetrics.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/UserMetrics.java
@@ -50,8 +50,8 @@ public interface UserMetrics {
long getWriteRequestCount();
/**
- * @return the number of write requests and read requests and coprocessor service requests made by
- * the user
+ * Returns the number of write requests and read requests and coprocessor service requests made by
+ * the user
*/
default long getRequestCount() {
return getReadRequestCount() + getWriteRequestCount();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/UserMetricsBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/UserMetricsBuilder.java
index ab63f19fec8..4a66283146d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/UserMetricsBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/UserMetricsBuilder.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hbase;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import org.apache.hadoop.hbase.util.Strings;
@@ -30,7 +31,8 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos;
public final class UserMetricsBuilder {
public static UserMetrics toUserMetrics(ClusterStatusProtos.UserLoad userLoad) {
- UserMetricsBuilder builder = UserMetricsBuilder.newBuilder(userLoad.getUserName().getBytes());
+ UserMetricsBuilder builder =
+ UserMetricsBuilder.newBuilder(userLoad.getUserName().getBytes(StandardCharsets.UTF_8));
userLoad.getClientMetricsList().stream()
.map(clientMetrics -> new ClientMetricsImpl(clientMetrics.getHostName(),
clientMetrics.getReadRequestsCount(), clientMetrics.getWriteRequestsCount(),
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractResponse.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractResponse.java
index bb44defbac6..b0a33eda402 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractResponse.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractResponse.java
@@ -27,11 +27,9 @@ abstract class AbstractResponse {
public enum ResponseType {
- SINGLE(0),
- MULTI(1);
+ SINGLE,
+ MULTI;
- ResponseType(int value) {
- }
}
public abstract ResponseType type();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractRpcBasedConnectionRegistry.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractRpcBasedConnectionRegistry.java
index bc1febe3803..4e97dcab24d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractRpcBasedConnectionRegistry.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AbstractRpcBasedConnectionRegistry.java
@@ -135,7 +135,7 @@ abstract class AbstractRpcBasedConnectionRegistry implements ConnectionRegistry
* Typically, you can use lambda expression to implement this interface as
*
* <pre>
- * (c, s, d) -> s.xxx(c, your request here, d)
+ * (c, s, d) -> s.xxx(c, your request here, d)
* </pre>
*/
@FunctionalInterface
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
index 6a0913c23c7..a2f34ebbd8e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
@@ -116,6 +116,7 @@ public interface Admin extends Abortable, Closeable {
Connection getConnection();
/**
+ * Check if a table exists.
* @param tableName Table to check.
* @return <code>true</code> if table exists already.
* @throws IOException if a remote or network exception occurs
@@ -267,8 +268,8 @@ public interface Admin extends Abortable, Closeable {
* Get a table descriptor.
* @param tableName as a {@link TableName}
* @return the read-only tableDescriptor
- * @throws org.apache.hadoop.hbase.TableNotFoundException
- * @throws IOException if a remote or network exception occurs
+ * @throws TableNotFoundException if the table was not found
+ * @throws IOException if a remote or network exception occurs
* @deprecated since 2.0 version and will be removed in 3.0 version. Use
* {@link #getDescriptor(TableName)}.
*/
@@ -280,8 +281,8 @@ public interface Admin extends Abortable, Closeable {
* Get a table descriptor.
* @param tableName as a {@link TableName}
* @return the tableDescriptor
- * @throws org.apache.hadoop.hbase.TableNotFoundException
- * @throws IOException if a remote or network exception occurs
+ * @throws TableNotFoundException if the table was not found
+ * @throws IOException if a remote or network exception occurs
*/
TableDescriptor getDescriptor(TableName tableName) throws TableNotFoundException, IOException;
@@ -290,7 +291,7 @@ public interface Admin extends Abortable, Closeable {
* @param desc table descriptor for table
* @throws IllegalArgumentException if the table name is reserved
* @throws org.apache.hadoop.hbase.MasterNotRunningException if master is not running
- * @throws org.apache.hadoop.hbase.TableExistsException if table already exists (If
+ * @throws TableExistsException if table already exists (If
* concurrent threads, the table may
* have been created between
* test-for-existence and
@@ -316,7 +317,7 @@ public interface Admin extends Abortable, Closeable {
* @throws IOException if a remote or network exception
* occurs
* @throws org.apache.hadoop.hbase.MasterNotRunningException if master is not running
- * @throws org.apache.hadoop.hbase.TableExistsException if table already exists (If
+ * @throws TableExistsException if table already exists (If
* concurrent threads, the table may
* have been created between
* test-for-existence and
@@ -335,7 +336,7 @@ public interface Admin extends Abortable, Closeable {
* split keys are repeated and if the
* split key has empty byte array.
* @throws org.apache.hadoop.hbase.MasterNotRunningException if master is not running
- * @throws org.apache.hadoop.hbase.TableExistsException if table already exists (If
+ * @throws TableExistsException if table already exists (If
* concurrent threads, the table may
* have been created between
* test-for-existence and
@@ -574,6 +575,7 @@ public interface Admin extends Abortable, Closeable {
HTableDescriptor[] disableTables(Pattern pattern) throws IOException;
/**
+ * Check if a table is enabled.
* @param tableName name of table to check
* @return <code>true</code> if table is on-line
* @throws IOException if a remote or network exception occurs
@@ -581,6 +583,7 @@ public interface Admin extends Abortable, Closeable {
boolean isTableEnabled(TableName tableName) throws IOException;
/**
+ * Check if a table is disabled.
* @param tableName name of table to check
* @return <code>true</code> if table is off-line
* @throws IOException if a remote or network exception occurs
@@ -588,6 +591,7 @@ public interface Admin extends Abortable, Closeable {
boolean isTableDisabled(TableName tableName) throws IOException;
/**
+ * Check if a table is available.
* @param tableName name of table to check
* @return <code>true</code> if all regions of the table are available
* @throws IOException if a remote or network exception occurs
@@ -1646,6 +1650,7 @@ public interface Admin extends Abortable, Closeable {
ClusterMetrics getClusterMetrics(EnumSet<Option> options) throws IOException;
/**
+ * Get the current active master.
* @return current master server name
* @throws IOException if a remote or network exception occurs
*/
@@ -1654,6 +1659,7 @@ public interface Admin extends Abortable, Closeable {
}
/**
+ * Get a list of current backup masters.
* @return current backup master list
* @throws IOException if a remote or network exception occurs
*/
@@ -1662,6 +1668,7 @@ public interface Admin extends Abortable, Closeable {
}
/**
+ * Get the live server list.
* @return current live region servers list
* @throws IOException if a remote or network exception occurs
*/
@@ -1772,7 +1779,7 @@ public interface Admin extends Abortable, Closeable {
* Get a namespace descriptor by name.
* @param name name of namespace descriptor
* @return A descriptor
- * @throws org.apache.hadoop.hbase.NamespaceNotFoundException
+ * @throws org.apache.hadoop.hbase.NamespaceNotFoundException if the namespace was not found
* @throws IOException if a remote or network exception
* occurs
*/
@@ -1929,9 +1936,8 @@ public interface Admin extends Abortable, Closeable {
* this method returns. As a side effect of this call, the named region server may schedule store
* flushes at the request of the wal.
* @param serverName The servername of the regionserver.
- * @throws IOException if a remote or network
- * exception occurs
- * @throws org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException
+ * @throws IOException if a remote or network exception occurs
+ * @throws FailedLogCloseException if we failed to close the WAL
*/
void rollWALWriter(ServerName serverName) throws IOException, FailedLogCloseException;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java
index bf1a29196db..31a57eacf4d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java
@@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory;
@InterfaceAudience.Public
public class Append extends Mutation {
private static final Logger LOG = LoggerFactory.getLogger(Append.class);
- private static final long HEAP_OVERHEAD = ClassSize.REFERENCE + ClassSize.TIMERANGE;
+ private static final long HEAP_OVERHEAD = (long) ClassSize.REFERENCE + ClassSize.TIMERANGE;
private TimeRange tr = TimeRange.allTime();
/**
@@ -166,6 +166,7 @@ public class Append extends Mutation {
* Add column and value to this Append operation. n * @return This instance
*/
@SuppressWarnings("unchecked")
+ @Override
public Append add(final Cell cell) {
try {
super.add(cell);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java
index 2d6d499042e..ca08c9dfc10 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdmin.java
@@ -61,6 +61,7 @@ import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
public interface AsyncAdmin {
/**
+ * Check if a table exists.
* @param tableName Table to check.
* @return True if table exists already. The return value will be wrapped by a
* {@link CompletableFuture}.
@@ -210,6 +211,7 @@ public interface AsyncAdmin {
CompletableFuture<Void> disableTable(TableName tableName);
/**
+ * Check if a table is enabled.
* @param tableName name of table to check
* @return true if table is on-line. The return value will be wrapped by a
* {@link CompletableFuture}.
@@ -217,6 +219,7 @@ public interface AsyncAdmin {
CompletableFuture<Boolean> isTableEnabled(TableName tableName);
/**
+ * Check if a table is disabled.
* @param tableName name of table to check
* @return true if table is off-line. The return value will be wrapped by a
* {@link CompletableFuture}.
@@ -224,6 +227,7 @@ public interface AsyncAdmin {
CompletableFuture<Boolean> isTableDisabled(TableName tableName);
/**
+ * Check if a table is available.
* @param tableName name of table to check
* @return true if all regions of the table are available. The return value will be wrapped by a
* {@link CompletableFuture}.
@@ -598,11 +602,15 @@ public interface AsyncAdmin {
CompletableFuture<Void> splitRegion(byte[] regionName, byte[] splitPoint);
/**
+ * Assign an individual region.
* @param regionName Encoded or full name of region to assign.
*/
CompletableFuture<Void> assign(byte[] regionName);
/**
+ * Unassign a region from current hosting regionserver. Region will then be assigned to a
+ * regionserver chosen at random. Region could be reassigned back to the same server. Use
+ * {@link #move(byte[], ServerName)} if you want to control the region movement.
* @param regionName Encoded or full name of region to unassign.
*/
CompletableFuture<Void> unassign(byte[] regionName);
@@ -1154,19 +1162,21 @@ public interface AsyncAdmin {
CompletableFuture<Void> rollWALWriter(ServerName serverName);
/**
- * Clear compacting queues on a region server. n * @param queues the set of queue name
+ * Clear compacting queues on a region server.
+ * @param serverName The servername of the region server.
+ * @param queues the set of queue name
*/
CompletableFuture<Void> clearCompactionQueues(ServerName serverName, Set<String> queues);
/**
- * Get a list of {@link RegionMetrics} of all regions hosted on a region seerver. n * @return a
- * list of {@link RegionMetrics} wrapped by {@link CompletableFuture}
+ * Get a list of {@link RegionMetrics} of all regions hosted on a region server.
+ * @return list of {@link RegionMetrics} wrapped by {@link CompletableFuture}
*/
CompletableFuture<List<RegionMetrics>> getRegionMetrics(ServerName serverName);
/**
- * Get a list of {@link RegionMetrics} of all regions hosted on a region seerver for a table. nn
- * * @return a list of {@link RegionMetrics} wrapped by {@link CompletableFuture}
+ * Get a list of {@link RegionMetrics} of all regions hosted on a region server for a table.
+ * @return a list of {@link RegionMetrics} wrapped by {@link CompletableFuture}
*/
CompletableFuture<List<RegionMetrics>> getRegionMetrics(ServerName serverName,
TableName tableName);
@@ -1227,8 +1237,8 @@ public interface AsyncAdmin {
CompletableFuture<Optional<Long>> getLastMajorCompactionTimestampForRegion(byte[] regionName);
/**
- * @return the list of supported security capabilities. The return value will be wrapped by a
- * {@link CompletableFuture}.
+ * Returns the list of supported security capabilities. The return value will be wrapped by a
+ * {@link CompletableFuture}.
*/
CompletableFuture<List<SecurityCapability>> getSecurityCapabilities();
@@ -1372,9 +1382,7 @@ public interface AsyncAdmin {
* one line lambda expression, like:
*
* <pre>
- * <code>
- * channel -> xxxService.newStub(channel)
- * </code>
+ * channel -> xxxService.newStub(channel)
* </pre>
*
* @param stubMaker a delegation to the actual {@code newStub} call.
@@ -1395,9 +1403,7 @@ public interface AsyncAdmin {
* one line lambda expression, like:
*
* <pre>
- * <code>
- * channel -> xxxService.newStub(channel)
- * </code>
+ * channel -> xxxService.newStub(channel)
* </pre>
*
* @param stubMaker a delegation to the actual {@code newStub} call.
@@ -1613,7 +1619,6 @@ public interface AsyncAdmin {
* @param serverType enum for server type: HMaster or RegionServer
* @param limit put a limit to list of records that server should send in response
* @param filterParams additional filter params
- * @return Log entries representing online records from servers
*/
CompletableFuture<List<LogEntry>> getLogEntries(Set<ServerName> serverNames, String logType,
ServerType serverType, int limit, Map<String, Object> filterParams);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdminRequestRetryingCaller.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdminRequestRetryingCaller.java
index de6e967f21c..d3bec8b3cfb 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdminRequestRetryingCaller.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncAdminRequestRetryingCaller.java
@@ -29,9 +29,6 @@ import org.apache.hbase.thirdparty.io.netty.util.Timer;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService;
-/**
- * @since 2.0.0
- */
@InterfaceAudience.Private
public class AsyncAdminRequestRetryingCaller<T> extends AsyncRpcRetryingCaller<T> {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java
index cfcb8daf488..987d86bd8aa 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java
@@ -539,7 +539,7 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
runnable.run();
} else {
try {
- pool.submit(runnable);
+ pool.execute(runnable);
} catch (Throwable t) {
if (t instanceof RejectedExecutionException) {
// This should never happen. But as the pool is provided by the end user,
@@ -564,6 +564,7 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
}
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private Collection<? extends Runnable> getNewMultiActionRunnable(ServerName server,
MultiAction multiAction, int numAttempt) {
// no stats to manage, just do the standard action
@@ -644,7 +645,7 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
// Start the thread that may kick off replica gets.
// TODO: we could do it on the same thread, but it's a user thread, might be a bad idea.
try {
- pool.submit(replicaRunnable);
+ pool.execute(replicaRunnable);
} catch (RejectedExecutionException ree) {
LOG.warn("id=" + asyncProcess.id + " replica task rejected by pool; no replica calls", ree);
}
@@ -770,6 +771,7 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
private void logNoResubmit(ServerName oldServer, int numAttempt, int failureCount,
Throwable throwable, int failed, int stopped) {
if (failureCount != 0 || numAttempt > asyncProcess.startLogErrorsCnt + 1) {
+ @SuppressWarnings("JavaUtilDate")
String timeStr = new Date(errorsByServer.getStartTrackingTime()).toString();
String logMessage = createLog(numAttempt, failureCount, 0, oldServer, throwable, -1, false,
timeStr, failed, stopped);
@@ -955,14 +957,14 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
if (result == null) {
throw new RuntimeException("Result cannot be null");
}
- ReplicaResultState state = null;
boolean isStale = !RegionReplicaUtil.isDefaultReplica(action.getReplicaId());
int index = action.getOriginalIndex();
if (results == null) {
decActionCounter(index);
return; // Simple case, no replica requests.
}
- state = trySetResultSimple(index, action.getAction(), false, result, null, isStale);
+ ReplicaResultState state =
+ trySetResultSimple(index, action.getAction(), false, result, null, isStale);
if (state == null) {
return; // Simple case, no replica requests.
}
@@ -995,7 +997,6 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
* @param server The source server.
*/
private void setError(int index, Row row, Throwable throwable, ServerName server) {
- ReplicaResultState state = null;
if (results == null) {
// Note that we currently cannot have replica requests with null results. So it shouldn't
// happen that multiple replica calls will call dAC for same actions with results == null.
@@ -1004,7 +1005,7 @@ class AsyncRequestFutureImpl<CResult> implements AsyncRequestFuture {
decActionCounter(index);
return; // Simple case, no replica requests.
}
- state = trySetResultSimple(index, row, true, throwable, server, false);
+ ReplicaResultState state = trySetResultSimple(index, row, true, throwable, server, false);
if (state == null) {
return; // Simple case, no replica requests.
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java
index aa696966ca6..2bd6b50df22 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java
@@ -223,16 +223,14 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
* This is a fluent style API, the code is like:
*
* <pre>
- * <code>
* table.checkAndMutate(row, family).qualifier(qualifier).ifNotExists().thenPut(put)
- * .thenAccept(succ -> {
- * if (succ) {
- * System.out.println("Check and put succeeded");
- * } else {
- * System.out.println("Check and put failed");
- * }
- * });
- * </code>
+ * .thenAccept(succ -> {
+ * if (succ) {
+ * System.out.println("Check and put succeeded");
+ * } else {
+ * System.out.println("Check and put failed");
+ * }
+ * });
* </pre>
*
* @deprecated Since 2.4.0, will be removed in 4.0.0. For internal test use only, do not use it
@@ -250,11 +248,13 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
interface CheckAndMutateBuilder {
/**
+ * Match a qualifier.
* @param qualifier column qualifier to check.
*/
CheckAndMutateBuilder qualifier(byte[] qualifier);
/**
+ * Match a timerange.
* @param timeRange time range to check.
*/
CheckAndMutateBuilder timeRange(TimeRange timeRange);
@@ -273,12 +273,14 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
}
/**
+ * Compare a value
* @param compareOp comparison operator to use
* @param value the expected value
*/
CheckAndMutateBuilder ifMatches(CompareOperator compareOp, byte[] value);
/**
+ * Specify a Put to commit if the check succeeds.
* @param put data to put if check succeeds
* @return {@code true} if the new put was executed, {@code false} otherwise. The return value
* will be wrapped by a {@link CompletableFuture}.
@@ -286,6 +288,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
CompletableFuture<Boolean> thenPut(Put put);
/**
+ * Specify a Delete to commit if the check succeeds.
* @param delete data to delete if check succeeds
* @return {@code true} if the new delete was executed, {@code false} otherwise. The return
* value will be wrapped by a {@link CompletableFuture}.
@@ -293,6 +296,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
CompletableFuture<Boolean> thenDelete(Delete delete);
/**
+ * Specify a RowMutations to commit if the check succeeds.
* @param mutation mutations to perform if check succeeds
* @return true if the new mutation was executed, false otherwise. The return value will be
* wrapped by a {@link CompletableFuture}.
@@ -308,16 +312,13 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
* execute it. This is a fluent style API, the code is like:
*
* <pre>
- * <code>
- * table.checkAndMutate(row, filter).thenPut(put)
- * .thenAccept(succ -> {
- * if (succ) {
- * System.out.println("Check and put succeeded");
- * } else {
- * System.out.println("Check and put failed");
- * }
- * });
- * </code>
+ * table.checkAndMutate(row, filter).thenPut(put).thenAccept(succ -> {
+ * if (succ) {
+ * System.out.println("Check and put succeeded");
+ * } else {
+ * System.out.println("Check and put failed");
+ * }
+ * });
* </pre>
*
* @deprecated Since 2.4.0, will be removed in 4.0.0. For internal test use only, do not use it
@@ -335,11 +336,13 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
interface CheckAndMutateWithFilterBuilder {
/**
+ * Match a timerange.
* @param timeRange time range to check.
*/
CheckAndMutateWithFilterBuilder timeRange(TimeRange timeRange);
/**
+ * Specify a Put to commit if the check succeeds.
* @param put data to put if check succeeds
* @return {@code true} if the new put was executed, {@code false} otherwise. The return value
* will be wrapped by a {@link CompletableFuture}.
@@ -347,6 +350,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
CompletableFuture<Boolean> thenPut(Put put);
/**
+ * Specify a Delete to commit if the check succeeds.
* @param delete data to delete if check succeeds
* @return {@code true} if the new delete was executed, {@code false} otherwise. The return
* value will be wrapped by a {@link CompletableFuture}.
@@ -354,6 +358,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
CompletableFuture<Boolean> thenDelete(Delete delete);
/**
+ * Specify a RowMutations to commit if the check succeeds.
* @param mutation mutations to perform if check succeeds
* @return true if the new mutation was executed, false otherwise. The return value will be
* wrapped by a {@link CompletableFuture}.
@@ -440,16 +445,14 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
* <p>
*
* <pre>
- * <code>
- * table.scanAll(new Scan().withStartRow(row, false).setLimit(1)).thenAccept(results -> {
+ * table.scanAll(new Scan().withStartRow(row, false).setLimit(1)).thenAccept(results -> {
* if (results.isEmpty()) {
- * System.out.println("No row after " + Bytes.toStringBinary(row));
+ * System.out.println("No row after " + Bytes.toStringBinary(row));
* } else {
* System.out.println("The closest row after " + Bytes.toStringBinary(row) + " is "
- * + Bytes.toStringBinary(results.stream().findFirst().get().getRow()));
+ * + Bytes.toStringBinary(results.stream().findFirst().get().getRow()));
* }
* });
- * </code>
* </pre>
* <p>
* If your result set is very large, you should use other scan method to get a scanner or use
@@ -574,9 +577,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
* one line lambda expression, like:
*
* <pre>
- * <code>
- * channel -> xxxService.newStub(channel)
- * </code>
+ * channel -> xxxService.newStub(channel)
* </pre>
*
* @param stubMaker a delegation to the actual {@code newStub} call.
@@ -609,7 +610,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
*
* <pre>
* locateThenCall(byte[] row) {
- * locate(row).whenComplete((location, locateError) -> {
+ * locate(row).whenComplete((location, locateError) -> {
* if (locateError != null) {
* callback.onError(locateError);
* return;
@@ -621,7 +622,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
* } else {
* locateThenCall(region.getEndKey());
* }
- * sendCall().whenComplete((resp, error) -> {
+ * sendCall().whenComplete((resp, error) -> {
* if (error != null) {
* callback.onRegionError(region, error);
* } else {
@@ -639,12 +640,14 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
interface CoprocessorCallback<R> {
/**
+ * Indicate that the respose of a region is available
* @param region the region that the response belongs to
* @param resp the response of the coprocessor call
*/
void onRegionComplete(RegionInfo region, R resp);
/**
+ * Indicate that the error for a region is available
* @param region the region that the error belongs to
* @param error the response error of the coprocessor call
*/
@@ -675,6 +678,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
interface CoprocessorServiceBuilder<S, R> {
/**
+ * Specify a start row
* @param startKey start region selection with region containing this row, inclusive.
*/
default CoprocessorServiceBuilder<S, R> fromRow(byte[] startKey) {
@@ -682,12 +686,14 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
}
/**
+ * Specify a start row
* @param startKey start region selection with region containing this row
* @param inclusive whether to include the startKey
*/
CoprocessorServiceBuilder<S, R> fromRow(byte[] startKey, boolean inclusive);
/**
+ * Specify a stop row
* @param endKey select regions up to and including the region containing this row, exclusive.
*/
default CoprocessorServiceBuilder<S, R> toRow(byte[] endKey) {
@@ -695,6 +701,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
}
/**
+ * Specify a stop row
* @param endKey select regions up to and including the region containing this row
* @param inclusive whether to include the endKey
*/
@@ -716,9 +723,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
* is only a one line lambda expression, like:
*
* <pre>
- * <code>
- * channel -> xxxService.newStub(channel)
- * </code>
+ * channel -> xxxService.newStub(channel)
* </pre>
*
* @param stubMaker a delegation to the actual {@code newStub} call.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableRegionLocator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableRegionLocator.java
index 11867ca333b..9fa32ee64aa 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableRegionLocator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableRegionLocator.java
@@ -89,7 +89,6 @@ public interface AsyncTableRegionLocator {
* Find all the replicas for the region on which the given row is being served.
* @param row Row to find.
* @return Locations for all the replicas of the row.
- * @throws IOException if a remote or network exception occurs
*/
default CompletableFuture<List<HRegionLocation>> getRegionLocations(byte[] row) {
return getRegionLocations(row, false);
@@ -100,7 +99,6 @@ public interface AsyncTableRegionLocator {
* @param row Row to find.
* @param reload true to reload information or false to use cached information
* @return Locations for all the replicas of the row.
- * @throws IOException if a remote or network exception occurs
*/
CompletableFuture<List<HRegionLocation>> getRegionLocations(byte[] row, boolean reload);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutatorParams.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutatorParams.java
index da3aa7f0975..ee614716f86 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutatorParams.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutatorParams.java
@@ -147,8 +147,8 @@ public class BufferedMutatorParams implements Cloneable {
}
/**
- * @return Name of the class we will use when we construct a {@link BufferedMutator} instance or
- * null if default implementation.
+ * Returns Name of the class we will use when we construct a {@link BufferedMutator} instance or
+ * null if default implementation.
*/
public String getImplementationClassName() {
return this.implementationClassName;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CatalogReplicaLoadBalanceSimpleSelector.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CatalogReplicaLoadBalanceSimpleSelector.java
index 1a148153bba..67549f9d610 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CatalogReplicaLoadBalanceSimpleSelector.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CatalogReplicaLoadBalanceSimpleSelector.java
@@ -129,6 +129,7 @@ class CatalogReplicaLoadBalanceSimpleSelector
* Selector's internal state.
* @param loc the location which causes exception.
*/
+ @Override
public void onError(HRegionLocation loc) {
ConcurrentNavigableMap<byte[], StaleLocationCacheEntry> tableCache = computeIfAbsent(staleCache,
loc.getRegion().getTable(), () -> new ConcurrentSkipListMap<>(BYTES_COMPARATOR));
@@ -160,18 +161,19 @@ class CatalogReplicaLoadBalanceSimpleSelector
* When it looks up a location, it will call this method to find a replica region to go. For a
* normal case, > 99% of region locations from catalog/meta replica will be up to date. In extreme
* cases such as region server crashes, it will depends on how fast replication catches up.
- * @param tablename table name it looks up
+ * @param tableName table name it looks up
* @param row key it looks up.
* @param locateType locateType, Only BEFORE and CURRENT will be passed in.
* @return catalog replica id
*/
- public int select(final TableName tablename, final byte[] row,
+ @Override
+ public int select(final TableName tableName, final byte[] row,
final RegionLocateType locateType) {
Preconditions.checkArgument(
locateType == RegionLocateType.BEFORE || locateType == RegionLocateType.CURRENT,
"Expected type BEFORE or CURRENT but got: %s", locateType);
- ConcurrentNavigableMap<byte[], StaleLocationCacheEntry> tableCache = staleCache.get(tablename);
+ ConcurrentNavigableMap<byte[], StaleLocationCacheEntry> tableCache = staleCache.get(tableName);
// If there is no entry in StaleCache, select a random replica id.
if (tableCache == null) {
@@ -200,7 +202,7 @@ class CatalogReplicaLoadBalanceSimpleSelector
(EnvironmentEdgeManager.currentTime() - entry.getValue().getTimestamp())
>= STALE_CACHE_TIMEOUT_IN_MILLISECONDS
) {
- LOG.debug("Entry for table {} with startKey {}, {} times out", tablename, entry.getKey(),
+ LOG.debug("Entry for table {} with startKey {}, {} times out", tableName, entry.getKey(),
entry);
tableCache.remove(entry.getKey());
return getRandomReplicaId();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CheckAndMutate.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CheckAndMutate.java
index e8949ee65ec..7f8d0677b6b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CheckAndMutate.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CheckAndMutate.java
@@ -97,6 +97,7 @@ public final class CheckAndMutate implements Row {
}
/**
+ * Check for match
* @param family family to check
* @param qualifier qualifier to check
* @param compareOp comparison operator to use
@@ -113,6 +114,7 @@ public final class CheckAndMutate implements Row {
}
/**
+ * Check for match
* @param filter filter to check
* @return the CheckAndMutate object
*/
@@ -122,6 +124,7 @@ public final class CheckAndMutate implements Row {
}
/**
+ * Specify a timerange
* @param timeRange time range to check
* @return the CheckAndMutate object
*/
@@ -144,6 +147,7 @@ public final class CheckAndMutate implements Row {
}
/**
+ * Build the CheckAndMutate object
* @param put data to put if check succeeds
* @return a CheckAndMutate object
*/
@@ -157,6 +161,7 @@ public final class CheckAndMutate implements Row {
}
/**
+ * Build the CheckAndMutate object
* @param delete data to delete if check succeeds
* @return a CheckAndMutate object
*/
@@ -170,6 +175,7 @@ public final class CheckAndMutate implements Row {
}
/**
+ * Build the CheckAndMutate object with an Increment to commit if the check succeeds.
* @param increment data to increment if check succeeds
* @return a CheckAndMutate object
*/
@@ -183,6 +189,7 @@ public final class CheckAndMutate implements Row {
}
/**
+ * Build the CheckAndMutate object with an Append to commit if the check succeeds.
* @param append data to append if check succeeds
* @return a CheckAndMutate object
*/
@@ -196,6 +203,7 @@ public final class CheckAndMutate implements Row {
}
/**
+ * Build the CheckAndMutate object with a RowMutations to commit if the check succeeds.
* @param mutations mutations to perform if check succeeds
* @return a CheckAndMutate object
*/
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientAsyncPrefetchScanner.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientAsyncPrefetchScanner.java
index 6c221590500..77ec41ec4e9 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientAsyncPrefetchScanner.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientAsyncPrefetchScanner.java
@@ -94,34 +94,35 @@ public class ClientAsyncPrefetchScanner extends ClientSimpleScanner {
public Result next() throws IOException {
try (Scope ignored = span.makeCurrent()) {
lock.lock();
- while (cache.isEmpty()) {
- handleException();
- if (this.closed) {
- return null;
+ try {
+ while (cache.isEmpty()) {
+ handleException();
+ if (this.closed) {
+ return null;
+ }
+ try {
+ notEmpty.await();
+ } catch (InterruptedException e) {
+ span.recordException(e);
+ throw new InterruptedIOException("Interrupted when wait to load cache");
+ }
}
- try {
- notEmpty.await();
- } catch (InterruptedException e) {
- span.recordException(e);
- throw new InterruptedIOException("Interrupted when wait to load cache");
+ Result result = pollCache();
+ if (prefetchCondition()) {
+ notFull.signalAll();
}
+ return result;
+ } finally {
+ lock.unlock();
+ handleException();
}
-
- Result result = pollCache();
- if (prefetchCondition()) {
- notFull.signalAll();
- }
- return result;
- } finally {
- lock.unlock();
- handleException();
}
}
@Override
public void close() {
+ lock.lock();
try {
- lock.lock();
super.close();
closed = true;
notFull.signalAll();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientIdGenerator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientIdGenerator.java
index f5bedbe88d2..ee497ef56c5 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientIdGenerator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientIdGenerator.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.client;
import java.io.IOException;
import java.lang.management.ManagementFactory;
+import java.util.List;
import org.apache.hadoop.hbase.util.Addressing;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
@@ -26,6 +27,9 @@ import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.hbase.thirdparty.com.google.common.base.Splitter;
+import org.apache.hbase.thirdparty.com.google.common.collect.Iterators;
+
/**
* The class that is able to determine some unique strings for the client, such as an IP address,
* PID, and composite deterministic ID.
@@ -38,8 +42,8 @@ final class ClientIdGenerator {
}
/**
- * @return a unique ID incorporating IP address, PID, TID and timer. Might be an overkill... Note
- * though that new UUID in java by default is just a random number.
+ * Returns a unique ID incorporating IP address, PID, TID and timer. Might be an overkill... Note
+ * though that new UUID in java by default is just a random number.
*/
public static byte[] generateClientId() {
byte[] selfBytes = getIpAddressBytes();
@@ -61,10 +65,10 @@ final class ClientIdGenerator {
/** Returns PID of the current process, if it can be extracted from JVM name, or null. */
public static Long getPid() {
String name = ManagementFactory.getRuntimeMXBean().getName();
- String[] nameParts = name.split("@");
- if (nameParts.length == 2) { // 12345@somewhere
+ List<String> nameParts = Splitter.on('@').splitToList(name);
+ if (nameParts.size() == 2) { // 12345@somewhere
try {
- return Long.parseLong(nameParts[0]);
+ return Long.parseLong(Iterators.get(nameParts.iterator(), 0));
} catch (NumberFormatException ex) {
LOG.warn("Failed to get PID from [" + name + "]", ex);
}
@@ -75,8 +79,8 @@ final class ClientIdGenerator {
}
/**
- * @return Some IPv4/IPv6 address available on the current machine that is up, not virtual and not
- * a loopback address. Empty array if none can be found or error occurred.
+ * Returns Some IPv4/IPv6 address available on the current machine that is up, not virtual and not
+ * a loopback address. Empty array if none can be found or error occurred.
*/
public static byte[] getIpAddressBytes() {
try {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
index 1d656873bbe..f240798c58d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
@@ -327,7 +327,7 @@ public abstract class ClientScanner extends AbstractClientScanner {
return cache != null ? cache.size() : 0;
}
- private boolean scanExhausted(Result[] values) {
+ private boolean scanExhausted() {
return callable.moreResultsForScan() == MoreResults.NO;
}
@@ -484,7 +484,7 @@ public abstract class ClientScanner extends AbstractClientScanner {
assert newLimit >= 0;
scan.setLimit(newLimit);
}
- if (scan.getLimit() == 0 || scanExhausted(values)) {
+ if (scan.getLimit() == 0 || scanExhausted()) {
closeScanner();
closed = true;
break;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientServiceCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientServiceCallable.java
index 367ad3bda48..c9220540e45 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientServiceCallable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientServiceCallable.java
@@ -29,7 +29,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos;
/**
* A RegionServerCallable set to use the Client protocol. Also includes some utility methods so can
* hide protobuf references here rather than have them sprinkled about the code base.
- * @param <T>
*/
@InterfaceAudience.Private
public abstract class ClientServiceCallable<T>
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnection.java
index 849745b89eb..219e63a6ffc 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnection.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnection.java
@@ -72,6 +72,7 @@ public interface ClusterConnection extends Connection {
boolean isTableEnabled(TableName tableName) throws IOException;
/**
+ * Check if a table is disabled.
* @param tableName table name
* @return true if the table is disabled, false otherwise
* @throws IOException if a remote or network exception occurs
@@ -95,6 +96,7 @@ public interface ClusterConnection extends Connection {
HRegionLocation locateRegion(final TableName tableName, final byte[] row) throws IOException;
/**
+ * Clear the region location cache.
* @deprecated {@link #clearRegionLocationCache()} instead.
*/
@Deprecated
@@ -179,6 +181,7 @@ public interface ClusterConnection extends Connection {
final boolean offlined) throws IOException;
/**
+ * Gets the locations of the region in the specified table, <i>tableName</i>, for a given row.
* @param tableName table to get regions of
* @param row the row
* @param useCache Should we use the cache to retrieve the region information.
@@ -190,6 +193,7 @@ public interface ClusterConnection extends Connection {
throws IOException;
/**
+ * Gets the locations of the region in the specified table, <i>tableName</i>, for a given row.
* @param tableName table to get regions of
* @param row the row
* @param useCache Should we use the cache to retrieve the region information.
@@ -280,8 +284,8 @@ public interface ClusterConnection extends Connection {
MetricsConnection getConnectionMetrics();
/**
- * @return true when this connection uses a {@link org.apache.hadoop.hbase.codec.Codec} and so
- * supports cell blocks.
+ * Returns true when this connection uses a {@link org.apache.hadoop.hbase.codec.Codec} and so
+ * supports cell blocks.
*/
boolean hasCellBlockSupport();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptor.java
index b3d8e4fd600..d73e67ee0fb 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptor.java
@@ -98,10 +98,7 @@ public interface ColumnFamilyDescriptor {
/** Returns an unmodifiable map. */
Map<String, String> getConfiguration();
- /**
- * @param key the key whose associated value is to be returned
- * @return accessing the configuration value by key.
- */
+ /** Returns accessing the configuration value by key. */
String getConfigurationValue(String key);
/** Returns replication factor set for this CF */
@@ -117,8 +114,8 @@ public interface ColumnFamilyDescriptor {
String getEncryptionType();
/**
- * @return in-memory compaction policy if set for the cf. Returns null if no policy is set for for
- * this column family
+ * Returns in-memory compaction policy if set for the cf. Returns null if no policy is set for for
+ * this column family
*/
MemoryCompactionPolicy getInMemoryCompaction();
@@ -163,32 +160,35 @@ public interface ColumnFamilyDescriptor {
int getTimeToLive();
/**
+ * Get a configuration value.
* @param key The key.
* @return A clone value. Null if no mapping for the key
*/
Bytes getValue(Bytes key);
/**
+ * Get a configuration value.
* @param key The key.
* @return A clone value. Null if no mapping for the key
*/
String getValue(String key);
/**
+ * Get a configuration value.
* @param key The key.
* @return A clone value. Null if no mapping for the key
*/
byte[] getValue(byte[] key);
/**
- * It clone all bytes of all elements.
+ * Get all configuration values. It clone all bytes of all elements.
* @return All values
*/
Map<Bytes, Bytes> getValues();
/**
- * @return True if hfile DATA type blocks should be cached (You cannot disable caching of INDEX
- * and BLOOM type blocks).
+ * Returns True if hfile DATA type blocks should be cached (You cannot disable caching of INDEX
+ * and BLOOM type blocks).
*/
boolean isBlockCacheEnabled();
@@ -202,8 +202,8 @@ public interface ColumnFamilyDescriptor {
boolean isCacheIndexesOnWrite();
/**
- * @return Whether KV tags should be compressed along with DataBlockEncoding. When no
- * DataBlockEncoding is been used, this is having no effect.
+ * Returns Whether KV tags should be compressed along with DataBlockEncoding. When no
+ * DataBlockEncoding is been used, this is having no effect.
*/
boolean isCompressTags();
@@ -211,8 +211,8 @@ public interface ColumnFamilyDescriptor {
boolean isEvictBlocksOnClose();
/**
- * @return True if we are to favor keeping all values for this column family in the HRegionServer
- * cache.
+ * Returns True if we are to favor keeping all values for this column family in the HRegionServer
+ * cache.
*/
boolean isInMemory();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java
index 37a63c955b2..814994abd39 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ColumnFamilyDescriptorBuilder.java
@@ -42,9 +42,6 @@ import org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ColumnFamilySchema;
-/**
- * @since 2.0.0
- */
@InterfaceAudience.Public
public class ColumnFamilyDescriptorBuilder {
// For future backward compatibility
@@ -330,6 +327,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Check if the column family name is legal.
* @param b Family name.
* @return <code>b</code>
* @throws IllegalArgumentException If not null and not a legitimate family name: i.e. 'printable'
@@ -398,6 +396,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Serialize the table descriptor to a byte array.
* @param desc The table descriptor to serialize
* @return This instance serialized with pb with pb magic prefix
*/
@@ -691,11 +690,6 @@ public class ColumnFamilyDescriptorBuilder {
return Collections.unmodifiableMap(values);
}
- /**
- * @param key The key.
- * @param value The value.
- * @return this (for chained invocation)
- */
public ModifyableColumnFamilyDescriptor setValue(byte[] key, byte[] value) {
return setValue(toBytesOrNull(key, Function.identity()),
toBytesOrNull(value, Function.identity()));
@@ -709,11 +703,6 @@ public class ColumnFamilyDescriptorBuilder {
return setValue(key, toBytesOrNull(value, Bytes::toBytes));
}
- /**
- * @param key The key.
- * @param value The value.
- * @return this (for chained invocation)
- */
private ModifyableColumnFamilyDescriptor setValue(Bytes key, Bytes value) {
if (value == null || value.getLength() == 0) {
values.remove(key);
@@ -723,10 +712,6 @@ public class ColumnFamilyDescriptorBuilder {
return this;
}
- /**
- * @param key Key whose key and value we're to remove from HCD parameters.
- * @return this (for chained invocation)
- */
public ModifyableColumnFamilyDescriptor removeValue(final Bytes key) {
return setValue(key, (Bytes) null);
}
@@ -758,6 +743,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the maximum number of versions to retain.
* @param maxVersions maximum number of versions
* @return this (for chained invocation)
*/
@@ -777,7 +763,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
- * Set minimum and maximum versions to keep
+ * Set minimum and maximum versions to keep.
* @param minVersions minimal number of versions
* @param maxVersions maximum number of versions
* @return this (for chained invocation)
@@ -804,10 +790,6 @@ public class ColumnFamilyDescriptorBuilder {
return getStringOrDefault(BLOCKSIZE_BYTES, Integer::valueOf, DEFAULT_BLOCKSIZE);
}
- /**
- * @param s Blocksize to use when writing out storefiles/hfiles on this column family.
- * @return this (for chained invocation)
- */
public ModifyableColumnFamilyDescriptor setBlocksize(int s) {
return setValue(BLOCKSIZE_BYTES, Integer.toString(s));
}
@@ -910,6 +892,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the inMemory flag
* @param inMemory True if we are to favor keeping all values for this column family in the
* HRegionServer cache
* @return this (for chained invocation)
@@ -924,10 +907,6 @@ public class ColumnFamilyDescriptorBuilder {
n -> MemoryCompactionPolicy.valueOf(n.toUpperCase()), null);
}
- /**
- * @param inMemoryCompaction the prefered in-memory compaction policy for this column family
- * @return this (for chained invocation)
- */
public ModifyableColumnFamilyDescriptor
setInMemoryCompaction(MemoryCompactionPolicy inMemoryCompaction) {
return setValue(IN_MEMORY_COMPACTION_BYTES, inMemoryCompaction.name());
@@ -939,10 +918,6 @@ public class ColumnFamilyDescriptorBuilder {
DEFAULT_KEEP_DELETED);
}
- /**
- * @param keepDeletedCells True if deleted rows should not be collected immediately.
- * @return this (for chained invocation)
- */
public ModifyableColumnFamilyDescriptor setKeepDeletedCells(KeepDeletedCells keepDeletedCells) {
return setValue(KEEP_DELETED_CELLS_BYTES, keepDeletedCells.name());
}
@@ -968,6 +943,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the time to live
* @param timeToLive Time-to-live of cell contents, in seconds.
* @return this (for chained invocation)
*/
@@ -976,9 +952,10 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the time to live
* @param timeToLive Time-to-live of cell contents, in seconds.
* @return this (for chained invocation)
- * @throws org.apache.hadoop.hbase.exceptions.HBaseException
+ * @throws org.apache.hadoop.hbase.exceptions.HBaseException exception
*/
public ModifyableColumnFamilyDescriptor setTimeToLive(String timeToLive) throws HBaseException {
return setTimeToLive(Integer.parseInt(PrettyPrinter.valueOf(timeToLive, Unit.TIME_INTERVAL)));
@@ -990,6 +967,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set minimum versions to retain.
* @param minVersions The minimum number of versions to keep. (used when timeToLive is set)
* @return this (for chained invocation)
*/
@@ -1019,6 +997,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the blockCacheEnabled flag
* @param blockCacheEnabled True if hfile DATA type blocks should be cached (We always cache
* INDEX and BLOOM blocks; you cannot turn this off).
* @return this (for chained invocation)
@@ -1043,10 +1022,6 @@ public class ColumnFamilyDescriptorBuilder {
DEFAULT_REPLICATION_SCOPE);
}
- /**
- * @param scope the scope tag
- * @return this (for chained invocation)
- */
public ModifyableColumnFamilyDescriptor setScope(int scope) {
return setValue(REPLICATION_SCOPE_BYTES, Integer.toString(scope));
}
@@ -1058,6 +1033,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the setCacheDataOnWrite flag
* @param value true if we should cache data blocks on write
* @return this (for chained invocation)
*/
@@ -1072,6 +1048,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the setCacheIndexesOnWrite flag
* @param value true if we should cache index blocks on write
* @return this (for chained invocation)
*/
@@ -1086,6 +1063,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the setCacheBloomsOnWrite flag.
* @param value true if we should cache bloomfilter blocks on write
* @return this (for chained invocation)
*/
@@ -1100,6 +1078,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the setEvictBlocksOnClose flag.
* @param value true if we should evict cached blocks from the blockcache on close
* @return this (for chained invocation)
*/
@@ -1114,6 +1093,7 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
+ * Set the setPrefetchBlocksOnOpen flag
* @param value true if we should prefetch blocks into the blockcache on open
* @return this (for chained invocation)
*/
@@ -1241,19 +1221,17 @@ public class ColumnFamilyDescriptorBuilder {
return COMPARATOR.compare(this, other);
}
- /**
- * @return This instance serialized with pb with pb magic prefix
- * @see #parseFrom(byte[])
- */
+ /** Returns This instance serialized with pb with pb magic prefix */
private byte[] toByteArray() {
return ProtobufUtil.prependPBMagic(ProtobufUtil.toColumnFamilySchema(this).toByteArray());
}
/**
+ * Parse the serialized representation of a {@link ModifyableColumnFamilyDescriptor}
* @param bytes A pb serialized {@link ModifyableColumnFamilyDescriptor} instance with pb magic
* prefix
* @return An instance of {@link ModifyableColumnFamilyDescriptor} made from <code>bytes</code>
- * n * @see #toByteArray()
+ * @see #toByteArray()
*/
private static ColumnFamilyDescriptor parseFrom(final byte[] bytes)
throws DeserializationException {
@@ -1299,8 +1277,8 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
- * Remove a configuration setting represented by the key from the {@link #configuration} map. n
- * * @return this (for chained invocation)
+ * Remove a configuration setting represented by the key from the {@link #configuration} map.
+ * @return this (for chained invocation)
*/
public ModifyableColumnFamilyDescriptor removeConfiguration(final String key) {
return setConfiguration(key, null);
@@ -1312,8 +1290,8 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
- * Set the encryption algorithm for use with this family n * @return this (for chained
- * invocation)
+ * Set the encryption algorithm for use with this family
+ * @return this (for chained invocation)
*/
public ModifyableColumnFamilyDescriptor setEncryptionType(String algorithm) {
return setValue(ENCRYPTION_BYTES, algorithm);
@@ -1325,7 +1303,8 @@ public class ColumnFamilyDescriptorBuilder {
}
/**
- * Set the raw crypto key attribute for the family n * @return this (for chained invocation)
+ * Set the raw crypto key attribute for the family
+ * @return this (for chained invocation)
*/
public ModifyableColumnFamilyDescriptor setEncryptionKey(byte[] keyBytes) {
return setValue(ENCRYPTION_KEY_BYTES, new Bytes(keyBytes));
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CompactType.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CompactType.java
index 225bb072db7..412fd76d9ec 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CompactType.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/CompactType.java
@@ -26,9 +26,7 @@ import org.apache.yetus.audience.InterfaceAudience;
@InterfaceAudience.Public
public enum CompactType {
- NORMAL(0),
- MOB(1);
+ NORMAL,
+ MOB
- CompactType(int value) {
- }
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
index bf97b71b137..8759adc2e97 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
@@ -189,9 +189,13 @@ public class ConnectionImplementation implements ClusterConnection, Closeable {
final int rpcTimeout;
/**
- * Global nonceGenerator shared per client.Currently there's no reason to limit its scope. Once
+ * Global nonceGenerator shared per client. Currently there's no reason to limit its scope. Once
* it's set under nonceGeneratorCreateLock, it is never unset or changed.
*/
+ // XXX: It is a bad pattern to assign a value to a static field from a constructor. However
+ // it would likely change semantics if we change it because the NonceGenerator is selected
+ // from configuration passed in as a parameter of the constructor. This has been cleaned up
+ // in later branches.
private static volatile NonceGenerator nonceGenerator = null;
/** The nonce generator lock. Only taken when creating Connection, which gets a private copy. */
private static final Object nonceGeneratorCreateLock = new Object();
@@ -294,7 +298,7 @@ public class ConnectionImplementation implements ClusterConnection, Closeable {
}
this.stats = ServerStatisticTracker.create(conf);
- this.interceptor = (new RetryingCallerInterceptorFactory(conf)).build();
+ this.interceptor = new RetryingCallerInterceptorFactory(conf).build();
this.rpcControllerFactory = RpcControllerFactory.instantiate(conf);
this.rpcCallerFactory = RpcRetryingCallerFactory.instantiate(conf, interceptor, this.stats);
this.backoffPolicy = ClientBackoffPolicyFactory.create(conf);
@@ -1186,6 +1190,7 @@ public class ConnectionImplementation implements ClusterConnection, Closeable {
* @param timeout how long to wait before timeout, in unit of millisecond
* @param maxTries how many times to try
*/
+ @SuppressWarnings("JavaUtilDate")
public ServerErrorTracker(long timeout, int maxTries) {
this.maxTries = maxTries;
this.canRetryUntil = EnvironmentEdgeManager.currentTime() + timeout;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
index 40d16fec49a..aaeece8d8fc 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
@@ -97,6 +97,7 @@ public final class ConnectionUtils {
}
/**
+ * Inject a nonce generator for testing.
* @param conn The connection for which to replace the generator.
* @param cnm Replaces the nonce generator used, for testing.
* @return old nonce generator.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java
index d2674254752..66716bea9cc 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java
@@ -109,8 +109,6 @@ public class Delete extends Mutation {
* <p>
* This timestamp is ONLY used for a delete row operation. If specifying families or columns, you
* must specify each timestamp individually.
- * @param row We make a local copy of this passed in row. nn * @param timestamp maximum version
- * timestamp (only for delete row)
*/
public Delete(final byte[] row, final int rowOffset, final int rowLength, long timestamp) {
checkRow(row, rowOffset, rowLength);
@@ -119,6 +117,7 @@ public class Delete extends Mutation {
}
/**
+ * Create a Delete operation using another Delete as template.
* @param deleteToCopy delete to copy
*/
public Delete(final Delete deleteToCopy) {
@@ -154,6 +153,7 @@ public class Delete extends Mutation {
* @param cell An existing cell of type "delete".
* @return this for invocation chaining n
*/
+ @Override
public Delete add(Cell cell) throws IOException {
super.add(cell);
return this;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
index 0672faeb73e..1128015d459 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
@@ -509,7 +509,7 @@ public class Get extends Query implements Row {
if (this == obj) {
return true;
}
- if (obj == null || getClass() != obj.getClass()) {
+ if (!(obj instanceof Row)) {
return false;
}
Row other = (Row) obj;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
index 90b499e416c..e3392d7dfce 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
@@ -30,7 +30,6 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -46,7 +45,6 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.CacheEvictionStats;
import org.apache.hadoop.hbase.CacheEvictionStatsBuilder;
import org.apache.hadoop.hbase.ClusterMetrics;
@@ -782,7 +780,7 @@ public class HBaseAdmin implements Admin {
*/
@Override
public HTableDescriptor[] deleteTables(Pattern pattern) throws IOException {
- List<HTableDescriptor> failed = new LinkedList<>();
+ List<HTableDescriptor> failed = new ArrayList<>();
for (HTableDescriptor table : listTables(pattern)) {
try {
deleteTable(table.getTableName());
@@ -900,7 +898,7 @@ public class HBaseAdmin implements Admin {
@Override
public HTableDescriptor[] enableTables(Pattern pattern) throws IOException {
- List<HTableDescriptor> failed = new LinkedList<>();
+ List<HTableDescriptor> failed = new ArrayList<>();
for (HTableDescriptor table : listTables(pattern)) {
if (isTableDisabled(table.getTableName())) {
try {
@@ -960,7 +958,7 @@ public class HBaseAdmin implements Admin {
@Override
public HTableDescriptor[] disableTables(Pattern pattern) throws IOException {
- List<HTableDescriptor> failed = new LinkedList<>();
+ List<HTableDescriptor> failed = new ArrayList<>();
for (HTableDescriptor table : listTables(pattern)) {
if (isTableEnabled(table.getTableName())) {
try {
@@ -1455,6 +1453,7 @@ public class HBaseAdmin implements Admin {
move(encodedRegionName, (ServerName) null);
}
+ @Override
public void move(final byte[] encodedRegionName, ServerName destServerName) throws IOException {
executeCallable(new MasterCallable<Void>(getConnection(), getRpcControllerFactory()) {
@Override
@@ -1557,7 +1556,7 @@ public class HBaseAdmin implements Admin {
MetaTableAccessor.getTableRegionsAndLocations(connection, tableName);
Map<ServerName,
List<RegionInfo>> regionInfoByServerName = pairs.stream()
- .filter(pair -> !(pair.getFirst().isOffline())).filter(pair -> pair.getSecond() != null)
+ .filter(pair -> !pair.getFirst().isOffline()).filter(pair -> pair.getSecond() != null)
.collect(Collectors.groupingBy(pair -> pair.getSecond(),
Collectors.mapping(pair -> pair.getFirst(), Collectors.toList())));
@@ -2836,7 +2835,7 @@ public class HBaseAdmin implements Admin {
@Override
public List<SnapshotDescription> listSnapshots(Pattern pattern) throws IOException {
- List<SnapshotDescription> matched = new LinkedList<>();
+ List<SnapshotDescription> matched = new ArrayList<>();
List<SnapshotDescription> snapshots = listSnapshots();
for (SnapshotDescription snapshot : snapshots) {
if (pattern.matcher(snapshot.getName()).matches()) {
@@ -2857,7 +2856,7 @@ public class HBaseAdmin implements Admin {
Pattern snapshotNamePattern) throws IOException {
TableName[] tableNames = listTableNames(tableNamePattern);
- List<SnapshotDescription> tableSnapshots = new LinkedList<>();
+ List<SnapshotDescription> tableSnapshots = new ArrayList<>();
List<SnapshotDescription> snapshots = listSnapshots(snapshotNamePattern);
List<TableName> listOfTableNames = Arrays.asList(tableNames);
@@ -2959,7 +2958,7 @@ public class HBaseAdmin implements Admin {
@Override
public List<QuotaSettings> getQuota(QuotaFilter filter) throws IOException {
- List<QuotaSettings> quotas = new LinkedList<>();
+ List<QuotaSettings> quotas = new ArrayList<>();
try (QuotaRetriever retriever = QuotaRetriever.open(conf, filter)) {
Iterator<QuotaSettings> iterator = retriever.iterator();
while (iterator.hasNext()) {
@@ -3017,21 +3016,6 @@ public class HBaseAdmin implements Admin {
};
}
- /**
- * Simple {@link Abortable}, throwing RuntimeException on abort.
- */
- private static class ThrowableAbortable implements Abortable {
- @Override
- public void abort(String why, Throwable e) {
- throw new RuntimeException(why, e);
- }
-
- @Override
- public boolean isAborted() {
- return true;
- }
- }
-
@Override
public CoprocessorRpcChannel coprocessorService(final ServerName serverName) {
return new SyncCoprocessorRpcChannel() {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HRegionLocator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HRegionLocator.java
index 7dd59c90961..50e4a26c07c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HRegionLocator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HRegionLocator.java
@@ -131,6 +131,7 @@ public class HRegionLocator implements RegionLocator {
return this.tableName;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private List<RegionLocations> listRegionLocations() throws IOException {
if (TableName.isMetaTableName(tableName)) {
return Collections
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
index acb5c9fda5d..f36c4af0de0 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
@@ -53,7 +53,6 @@ import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.coprocessor.Batch;
-import org.apache.hadoop.hbase.client.coprocessor.Batch.Callback;
import org.apache.hadoop.hbase.client.trace.TableOperationSpanBuilder;
import org.apache.hadoop.hbase.client.trace.TableSpanBuilder;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
@@ -481,8 +480,8 @@ public class HTable implements Table {
}
public static <R> void doBatchWithCallback(List<? extends Row> actions, Object[] results,
- Callback<R> callback, ClusterConnection connection, ExecutorService pool, TableName tableName)
- throws InterruptedIOException, RetriesExhaustedWithDetailsException {
+ Batch.Callback<R> callback, ClusterConnection connection, ExecutorService pool,
+ TableName tableName) throws InterruptedIOException, RetriesExhaustedWithDetailsException {
int operationTimeout = connection.getConnectionConfiguration().getOperationTimeout();
int writeTimeout = connection.getConfiguration().getInt(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY,
connection.getConfiguration().getInt(HConstants.HBASE_RPC_TIMEOUT_KEY,
@@ -1264,7 +1263,7 @@ public class HTable implements Table {
@Override
public <R extends Message> void batchCoprocessorService(
final Descriptors.MethodDescriptor methodDescriptor, final Message request, byte[] startKey,
- byte[] endKey, final R responsePrototype, final Callback<R> callback)
+ byte[] endKey, final R responsePrototype, final Batch.Callback<R> callback)
throws ServiceException, Throwable {
final Supplier<Span> supplier = new TableOperationSpanBuilder(connection)
.setTableName(tableName).setOperation(HBaseSemanticAttributes.Operation.COPROC_EXEC);
@@ -1310,7 +1309,7 @@ public class HTable implements Table {
RpcRetryingCallerFactory.instantiate(configuration, connection.getStatisticsTracker()),
RpcControllerFactory.instantiate(configuration));
- Callback<ClientProtos.CoprocessorServiceResult> resultsCallback =
+ Batch.Callback<ClientProtos.CoprocessorServiceResult> resultsCallback =
(byte[] region, byte[] row, ClientProtos.CoprocessorServiceResult serviceResult) -> {
if (LOG.isTraceEnabled()) {
LOG.trace("Received result for endpoint {}: region={}, row={}, value={}",
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
index 7404d460b55..ddfe7ca439a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
@@ -222,6 +222,7 @@ public class HTableMultiplexer {
}
@InterfaceAudience.Private
+ @SuppressWarnings("FutureReturnValueIgnored")
LinkedBlockingQueue<PutStatus> getQueue(HRegionLocation addr) {
FlushWorker worker = serverToFlushWorkerMap.get(addr);
if (worker == null) {
@@ -455,6 +456,7 @@ public class HTableMultiplexer {
return this.maxLatency.getAndSet(0);
}
+ @SuppressWarnings("FutureReturnValueIgnored")
boolean resubmitFailedPut(PutStatus ps, HRegionLocation oldLoc) throws IOException {
// Decrease the retry count
final int retryCount = ps.maxAttempCount - 1;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
index 0efd71e69d2..86c0b65cc43 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
@@ -94,6 +94,7 @@ public class Increment extends Mutation {
* Add the specified KeyValue to this operation.
* @param cell individual Cell n * @throws java.io.IOException e
*/
+ @Override
public Increment add(Cell cell) throws IOException {
super.add(cell);
return this;
@@ -274,7 +275,7 @@ public class Increment extends Mutation {
if (this == obj) {
return true;
}
- if (obj == null || getClass() != obj.getClass()) {
+ if (!(obj instanceof Increment)) {
return false;
}
Row other = (Row) obj;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/IsolationLevel.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/IsolationLevel.java
index 7804e48de9f..3f94fc30f9c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/IsolationLevel.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/IsolationLevel.java
@@ -29,11 +29,8 @@ import org.apache.yetus.audience.InterfaceAudience;
@InterfaceAudience.Public
public enum IsolationLevel {
- READ_COMMITTED(1),
- READ_UNCOMMITTED(2);
-
- IsolationLevel(int value) {
- }
+ READ_COMMITTED,
+ READ_UNCOMMITTED;
public byte[] toBytes() {
return new byte[] { toByte() };
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/LogQueryFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/LogQueryFilter.java
index b2d217da3de..61137076a12 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/LogQueryFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/LogQueryFilter.java
@@ -112,13 +112,10 @@ public class LogQueryFilter {
if (this == o) {
return true;
}
-
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof LogQueryFilter)) {
return false;
}
-
LogQueryFilter that = (LogQueryFilter) o;
-
return new EqualsBuilder().append(limit, that.limit).append(regionName, that.regionName)
.append(clientAddress, that.clientAddress).append(tableName, that.tableName)
.append(userName, that.userName).append(type, that.type)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MasterCoprocessorRpcChannelImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MasterCoprocessorRpcChannelImpl.java
index c6f0ceec550..e315e56ed27 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MasterCoprocessorRpcChannelImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MasterCoprocessorRpcChannelImpl.java
@@ -77,11 +77,11 @@ class MasterCoprocessorRpcChannelImpl implements RpcChannel {
Message responsePrototype, RpcCallback<Message> done) {
addListener(
callerBuilder.action((c, s) -> rpcCall(method, request, responsePrototype, c, s)).call(),
- ((r, e) -> {
+ (r, e) -> {
if (e != null) {
((ClientCoprocessorRpcController) controller).setFailed(e);
}
done.run(r);
- }));
+ });
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MasterRegistry.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MasterRegistry.java
index a031d353097..28ac5bb4528 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MasterRegistry.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MasterRegistry.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.util.DNS.ServerType;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
+import org.apache.hbase.thirdparty.com.google.common.base.Splitter;
import org.apache.hbase.thirdparty.com.google.common.base.Strings;
import org.apache.hbase.thirdparty.com.google.common.net.HostAndPort;
@@ -78,7 +79,8 @@ public class MasterRegistry extends AbstractRpcBasedConnectionRegistry {
public static Set<ServerName> parseMasterAddrs(Configuration conf) throws UnknownHostException {
Set<ServerName> masterAddrs = new HashSet<>();
String configuredMasters = getMasterAddr(conf);
- for (String masterAddr : configuredMasters.split(MASTER_ADDRS_CONF_SEPARATOR)) {
+ for (String masterAddr : Splitter.onPattern(MASTER_ADDRS_CONF_SEPARATOR)
+ .split(configuredMasters)) {
HostAndPort masterHostPort =
HostAndPort.fromString(masterAddr.trim()).withDefaultPort(HConstants.DEFAULT_MASTER_PORT);
masterAddrs.add(ServerName.valueOf(masterHostPort.toString(), ServerName.NON_STARTCODE));
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiAction.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiAction.java
index cc3db106c4e..fbb1824595f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiAction.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiAction.java
@@ -36,8 +36,10 @@ import org.apache.yetus.audience.InterfaceAudience;
public final class MultiAction {
// TODO: This class should not be visible outside of the client package.
- // map of regions to lists of puts/gets/deletes for that region.
- protected Map<byte[], List<Action>> actions = new TreeMap<>(Bytes.BYTES_COMPARATOR);
+ /**
+ * A map of regions to lists of puts/gets/deletes for that region. Package visible.
+ */
+ Map<byte[], List<Action>> actions = new TreeMap<>(Bytes.BYTES_COMPARATOR);
private long nonceGroup = HConstants.NO_NONCE;
@@ -60,7 +62,7 @@ public final class MultiAction {
/**
* Add an Action to this container based on it's regionName. If the regionName is wrong, the
* initial execution will fail, but will be automatically retried after looking up the correct
- * region. nn
+ * region.
*/
public void add(byte[] regionName, Action a) {
add(regionName, Collections.singletonList(a));
@@ -69,7 +71,7 @@ public final class MultiAction {
/**
* Add an Action to this container based on it's regionName. If the regionName is wrong, the
* initial execution will fail, but will be automatically retried after looking up the correct
- * region. n * @param actionList list of actions to add for the region
+ * region.
*/
public void add(byte[] regionName, List<Action> actionList) {
List<Action> rsActions = actions.get(regionName);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java
index b768b76fdb6..341341b4336 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java
@@ -53,11 +53,7 @@ public class MultiResponse extends AbstractResponse {
return size;
}
- /**
- * Add the pair to the container, grouped by the regionName n * @param originalIndex the original
- * index of the Action (request).
- * @param resOrEx the result or error; will be empty for successful Put and Delete actions.
- */
+ /** Add the pair to the container, grouped by the regionName. */
public void add(byte[] regionName, int originalIndex, Object resOrEx) {
getResult(regionName).addResult(originalIndex, resOrEx);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java
index 6484235b1eb..86b499ea567 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java
@@ -44,7 +44,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.RegionActi
* Callable that handles the <code>multi</code> method call going against a single regionserver;
* i.e. A RegionServerCallable for the multi call (It is NOT a RegionServerCallable that goes
* against multiple regions).
- * @param <R>
*/
@InterfaceAudience.Private
class MultiServerCallable extends CancellableRegionServerCallable<MultiResponse> {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MutableRegionInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MutableRegionInfo.java
index 7627f8dc0e5..fbb76ea4f65 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MutableRegionInfo.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MutableRegionInfo.java
@@ -230,6 +230,7 @@ class MutableRegionInfo implements RegionInfo {
}
/**
+ * Change the split status flag.
* @param split set split status n
*/
public MutableRegionInfo setSplit(boolean split) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
index 408b02e44fa..ac1e9fce079 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
@@ -152,7 +152,7 @@ public abstract class Mutation extends OperationWithAttributes
return list;
}
- /*
+ /**
* Create a KeyValue with this objects row key and the Put identifier.
* @return a KeyValue with this objects row key and the Put identifier.
*/
@@ -161,8 +161,7 @@ public abstract class Mutation extends OperationWithAttributes
}
/**
- * Create a KeyValue with this objects row key and the Put identifier. nnnn * @param tags -
- * Specify the Tags as an Array
+ * Create a KeyValue with this objects row key and the Put identifier.
* @return a KeyValue with this objects row key and the Put identifier.
*/
KeyValue createPutKeyValue(byte[] family, byte[] qualifier, long ts, byte[] value, Tag[] tags) {
@@ -170,7 +169,7 @@ public abstract class Mutation extends OperationWithAttributes
return kvWithTag;
}
- /*
+ /**
* Create a KeyValue with this objects row key and the Put identifier.
* @return a KeyValue with this objects row key and the Put identifier.
*/
@@ -183,7 +182,7 @@ public abstract class Mutation extends OperationWithAttributes
/**
* Compile the column family (i.e. schema) information into a Map. Useful for parsing and
- * aggregation by debugging, logging, and administration tools. n
+ * aggregation by debugging, logging, and administration tools.
*/
@Override
public Map<String, Object> getFingerprint() {
@@ -257,7 +256,7 @@ public abstract class Mutation extends OperationWithAttributes
if (tags != null) {
List<String> tagsString = new ArrayList<>(tags.size());
for (Tag t : tags) {
- tagsString.add((t.getType()) + ":" + Bytes.toStringBinary(Tag.cloneValue(t)));
+ tagsString.add(t.getType() + ":" + Bytes.toStringBinary(Tag.cloneValue(t)));
}
stringMap.put("tag", tagsString);
}
@@ -473,6 +472,7 @@ public abstract class Mutation extends OperationWithAttributes
}
/**
+ * Set the ACL for this operation.
* @param user User short name
* @param perms Permissions for the user
*/
@@ -483,6 +483,7 @@ public abstract class Mutation extends OperationWithAttributes
}
/**
+ * Set the ACL for this operation.
* @param perms A map of permissions for a user or users
*/
public Mutation setACL(Map<String, Permission> perms) {
@@ -624,11 +625,9 @@ public abstract class Mutation extends OperationWithAttributes
return filteredList;
}
- /*
+ /**
* Private method to determine if this object's familyMap contains the given value assigned to the
- * given family, qualifier and timestamp respecting the 2 boolean arguments nnnnnn * @return
- * returns true if the given family, qualifier timestamp and value already has an existing
- * KeyValue object in the family map.
+ * given family, qualifier and timestamp, respecting the 2 boolean arguments.
*/
protected boolean has(byte[] family, byte[] qualifier, long ts, byte[] value, boolean ignoreTS,
boolean ignoreValue) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/PreemptiveFastFailInterceptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/PreemptiveFastFailInterceptor.java
index 0223109c4e8..edca3c7b6b6 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/PreemptiveFastFailInterceptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/PreemptiveFastFailInterceptor.java
@@ -86,7 +86,8 @@ class PreemptiveFastFailInterceptor extends RetryingCallerInterceptor {
// fast fail mode for any reason.
private long fastFailClearingTimeMilliSec;
- private final ThreadLocal<MutableBoolean> threadRetryingInFastFailMode = new ThreadLocal<>();
+ private static final ThreadLocal<MutableBoolean> threadRetryingInFastFailMode =
+ new ThreadLocal<>();
public PreemptiveFastFailInterceptor(Configuration conf) {
this.fastFailThresholdMilliSec = conf.getLong(HConstants.HBASE_CLIENT_FAST_FAIL_THREASHOLD_MS,
@@ -216,8 +217,8 @@ class PreemptiveFastFailInterceptor extends RetryingCallerInterceptor {
* @return true, if the thread is already in FF mode.
*/
private boolean currentThreadInFastFailMode() {
- return (this.threadRetryingInFastFailMode.get() != null
- && (this.threadRetryingInFastFailMode.get().booleanValue() == true));
+ return (threadRetryingInFastFailMode.get() != null
+ && (threadRetryingInFastFailMode.get().booleanValue() == true));
}
/**
@@ -232,10 +233,10 @@ class PreemptiveFastFailInterceptor extends RetryingCallerInterceptor {
// actively trying to connect. If we are the chosen one, we will retry
// and not throw an exception.
if (fInfo != null && fInfo.exclusivelyRetringInspiteOfFastFail.compareAndSet(false, true)) {
- MutableBoolean threadAlreadyInFF = this.threadRetryingInFastFailMode.get();
+ MutableBoolean threadAlreadyInFF = threadRetryingInFastFailMode.get();
if (threadAlreadyInFF == null) {
threadAlreadyInFF = new MutableBoolean();
- this.threadRetryingInFastFailMode.set(threadAlreadyInFF);
+ threadRetryingInFastFailMode.set(threadAlreadyInFF);
}
threadAlreadyInFF.setValue(true);
return true;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
index a3502f29bd0..df26f091ff7 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
@@ -257,6 +257,7 @@ public class Put extends Mutation implements HeapSize {
* immutable and its backing array will not be modified for the duration of this Put.
* @param cell individual cell n * @throws java.io.IOException e
*/
+ @Override
public Put add(Cell cell) throws IOException {
super.add(cell);
return this;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
index d752693dabc..a954d84db0e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
@@ -88,6 +88,7 @@ public abstract class Query extends OperationWithAttributes {
}
/**
+ * Set the ACL for the operation.
* @param user User short name
* @param perms Permissions for the user
*/
@@ -98,6 +99,7 @@ public abstract class Query extends OperationWithAttributes {
}
/**
+ * Set the ACL for the operation.
* @param perms A map of permissions for a user or users
*/
public Query setACL(Map<String, Permission> perms) {
@@ -159,9 +161,8 @@ public abstract class Query extends OperationWithAttributes {
}
/**
- * @return The isolation level of this query. If no isolation level was set for this query object,
- * then it returns READ_COMMITTED.
- * @return The IsolationLevel for this query
+ * Returns The isolation level of this query. If no isolation level was set for this query object,
+ * then it returns READ_COMMITTED.
*/
public IsolationLevel getIsolationLevel() {
byte[] attr = getAttribute(ISOLATION_LEVEL);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
index 8634f33c163..a310e7d864f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
@@ -469,11 +469,6 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
return future;
}
- @FunctionalInterface
- private interface TableOperator {
- CompletableFuture<Void> operate(TableName table);
- }
-
@Override
public CompletableFuture<Boolean> tableExists(TableName tableName) {
if (TableName.isMetaTableName(tableName)) {
@@ -1539,11 +1534,13 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
future.completeExceptionally(err);
return;
}
- addListener(this.<Void> newMasterCaller().priority(regionInfo.getTable())
- .action(((controller, stub) -> this.<AssignRegionRequest, AssignRegionResponse, Void> call(
- controller, stub, RequestConverter.buildAssignRegionRequest(regionInfo.getRegionName()),
- (s, c, req, done) -> s.assignRegion(c, req, done), resp -> null)))
- .call(), (ret, err2) -> {
+ addListener(
+ this.<Void> newMasterCaller().priority(regionInfo.getTable())
+ .action((controller, stub) -> this.<AssignRegionRequest, AssignRegionResponse, Void> call(
+ controller, stub, RequestConverter.buildAssignRegionRequest(regionInfo.getRegionName()),
+ (s, c, req, done) -> s.assignRegion(c, req, done), resp -> null))
+ .call(),
+ (ret, err2) -> {
if (err2 != null) {
future.completeExceptionally(err2);
} else {
@@ -1564,10 +1561,10 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
}
addListener(
this.<Void> newMasterCaller().priority(regionInfo.getTable())
- .action(((controller, stub) -> this.<UnassignRegionRequest, UnassignRegionResponse,
+ .action((controller, stub) -> this.<UnassignRegionRequest, UnassignRegionResponse,
Void> call(controller, stub,
RequestConverter.buildUnassignRegionRequest(regionInfo.getRegionName()),
- (s, c, req, done) -> s.unassignRegion(c, req, done), resp -> null)))
+ (s, c, req, done) -> s.unassignRegion(c, req, done), resp -> null))
.call(),
(ret, err2) -> {
if (err2 != null) {
@@ -1588,14 +1585,11 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
future.completeExceptionally(err);
return;
}
- addListener(
- this.<Void> newMasterCaller().priority(regionInfo.getTable())
- .action(((controller, stub) -> this.<OfflineRegionRequest, OfflineRegionResponse,
- Void> call(controller, stub,
- RequestConverter.buildOfflineRegionRequest(regionInfo.getRegionName()),
- (s, c, req, done) -> s.offlineRegion(c, req, done), resp -> null)))
- .call(),
- (ret, err2) -> {
+ addListener(this.<Void> newMasterCaller().priority(regionInfo.getTable())
+ .action((controller, stub) -> this.<OfflineRegionRequest, OfflineRegionResponse, Void> call(
+ controller, stub, RequestConverter.buildOfflineRegionRequest(regionInfo.getRegionName()),
+ (s, c, req, done) -> s.offlineRegion(c, req, done), resp -> null))
+ .call(), (ret, err2) -> {
if (err2 != null) {
future.completeExceptionally(err2);
} else {
@@ -2206,7 +2200,7 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
listSnapshotsFuture = getCompletedSnapshots(tableNamePattern, snapshotNamePattern);
}
CompletableFuture<Void> future = new CompletableFuture<>();
- addListener(listSnapshotsFuture, ((snapshotDescriptions, err) -> {
+ addListener(listSnapshotsFuture, (snapshotDescriptions, err) -> {
if (err != null) {
future.completeExceptionally(err);
return;
@@ -2223,7 +2217,7 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
future.complete(v);
}
});
- }));
+ });
return future;
}
@@ -3966,9 +3960,9 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
private CompletableFuture<Boolean> clearSlowLogsResponses(final ServerName serverName) {
return this.<Boolean> newAdminCaller()
- .action(((controller, stub) -> this.adminCall(controller, stub,
+ .action((controller, stub) -> this.adminCall(controller, stub,
RequestConverter.buildClearSlowLogResponseRequest(),
- AdminService.Interface::clearSlowLogsResponses, ProtobufUtil::toClearSlowLogPayload)))
+ AdminService.Interface::clearSlowLogsResponses, ProtobufUtil::toClearSlowLogPayload))
.serverName(serverName).call();
}
@@ -4030,9 +4024,9 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
public CompletableFuture<Void> flushMasterStore() {
FlushMasterStoreRequest.Builder request = FlushMasterStoreRequest.newBuilder();
return this.<Void> newMasterCaller()
- .action(((controller, stub) -> this.<FlushMasterStoreRequest, FlushMasterStoreResponse,
+ .action((controller, stub) -> this.<FlushMasterStoreRequest, FlushMasterStoreResponse,
Void> call(controller, stub, request.build(),
- (s, c, req, done) -> s.flushMasterStore(c, req, done), resp -> null)))
+ (s, c, req, done) -> s.flushMasterStore(c, req, done), resp -> null))
.call();
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncTableImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncTableImpl.java
index ccf879f1684..7ffd9eabd7d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncTableImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncTableImpl.java
@@ -814,7 +814,7 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
int c = Bytes.compareTo(endKey, region.getEndKey());
// 1. if the region contains endKey
// 2. endKey is equal to the region's endKey and we do not want to include endKey.
- return c < 0 || c == 0 && !endKeyInclusive;
+ return c < 0 || (c == 0 && !endKeyInclusive);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorServiceExec.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorServiceExec.java
index 720e97df636..5c3409813d4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorServiceExec.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorServiceExec.java
@@ -93,7 +93,7 @@ public class RegionCoprocessorServiceExec implements Row {
if (this == obj) {
return true;
}
- if (obj == null || getClass() != obj.getClass()) {
+ if (!(obj instanceof RegionCoprocessorServiceExec)) {
return false;
}
return compareTo((RegionCoprocessorServiceExec) obj) == 0;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
index de3f53707b8..88731ab1616 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
@@ -160,7 +160,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
long getRegionId();
/**
- * @return the regionName as an array of bytes.
+ * Returns the regionName as an array of bytes.
* @see #getRegionNameAsString()
*/
byte[] getRegionName();
@@ -190,7 +190,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
boolean isSplit();
/**
- * @return True if this region is offline.
+ * Returns True if this region is offline.
* @deprecated since 3.0.0 and will be removed in 4.0.0
* @see <a href="https://issues.apache.org/jira/browse/HBASE-25210">HBASE-25210</a>
*/
@@ -198,7 +198,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
boolean isOffline();
/**
- * @return True if this is a split parent region.
+ * Returns True if this is a split parent region.
* @deprecated since 3.0.0 and will be removed in 4.0.0, Use {@link #isSplit()} instead.
* @see <a href="https://issues.apache.org/jira/browse/HBASE-25210">HBASE-25210</a>
*/
@@ -209,9 +209,9 @@ public interface RegionInfo extends Comparable<RegionInfo> {
boolean isMetaRegion();
/**
- * @return true if the given inclusive range of rows is fully contained by this region. For
- * example, if the region is foo,a,g and this is passed ["b","c"] or ["a","c"] it will
- * return true, but if this is passed ["b","z"] it will return false.
+ * Returns true if the given inclusive range of rows is fully contained by this region. For
+ * example, if the region is foo,a,g and this is passed ["b","c"] or ["a","c"] it will return
+ * true, but if this is passed ["b","z"] it will return false.
* @throws IllegalArgumentException if the range passed is invalid (ie. end < start)
*/
boolean containsRange(byte[] rangeStartKey, byte[] rangeEndKey);
@@ -271,16 +271,16 @@ public interface RegionInfo extends Comparable<RegionInfo> {
}
/**
- * @return Return a String of short, printable names for <code>hris</code> (usually encoded name)
- * for us logging.
+ * Returns a String of short, printable names for <code>hris</code> (usually encoded name) for us
+ * logging.
*/
static String getShortNameToLog(RegionInfo... hris) {
return getShortNameToLog(Arrays.asList(hris));
}
/**
- * @return Return a String of short, printable names for <code>hris</code> (usually encoded name)
- * for us logging.
+ * Returns a String of short, printable names for <code>hris</code> (usually encoded name) for us
+ * logging.
*/
static String getShortNameToLog(final List<RegionInfo> ris) {
return ris.stream().map(RegionInfo::getEncodedName).collect(Collectors.toList()).toString();
@@ -369,8 +369,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
}
/**
- * @param bytes A pb RegionInfo serialized with a pb magic prefix.
- * @return A deserialized {@link RegionInfo}
+ * Returns A deserialized {@link RegionInfo}
*/
@InterfaceAudience.Private
static RegionInfo parseFrom(final byte[] bytes) throws DeserializationException {
@@ -379,6 +378,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
}
/**
+ * Parse a serialized representation of {@link RegionInfo}
* @param bytes A pb RegionInfo serialized with a pb magic prefix.
* @param offset starting point in the byte array
* @param len length to read on the byte array
@@ -437,7 +437,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
}
/**
- * @return This instance serialized as protobuf w/ a magic pb prefix.
+ * Returns This instance serialized as protobuf w/ a magic pb prefix.
* @see #parseFrom(byte[])
*/
static byte[] toByteArray(RegionInfo ri) {
@@ -765,7 +765,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
}
/**
- * @return True if region is next, adjacent but 'after' this one.
+ * Returns True if region is next, adjacent but 'after' this one.
* @see #isAdjacent(RegionInfo)
* @see #areAdjacent(RegionInfo, RegionInfo)
*/
@@ -774,7 +774,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
}
/**
- * @return True if region is adjacent, either just before or just after this one.
+ * Returns True if region is adjacent, either just before or just after this one.
* @see #isNext(RegionInfo)
*/
default boolean isAdjacent(RegionInfo other) {
@@ -787,7 +787,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
}
/**
- * @return True if an overlap in region range.
+ * Returns True if an overlap in region range.
* @see #isDegenerate()
*/
default boolean isOverlap(RegionInfo other) {
@@ -813,6 +813,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
return Bytes.compareTo(getStartKey(), other.getEndKey()) < 0;
}
+ @Override
default int compareTo(RegionInfo other) {
return RegionInfo.COMPARATOR.compare(this, other);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java
index 4475a01c0f9..1d6708b49d1 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java
@@ -51,7 +51,7 @@ public class RegionReplicaUtil {
/**
* Returns the RegionInfo for the given replicaId. RegionInfo's correspond to a range of a table,
* but more than one "instance" of the same range can be deployed which are differentiated by the
- * replicaId. n * @param replicaId the replicaId to use
+ * replicaId.
* @return an RegionInfo object corresponding to the same range (table, start and end key), but
* for the given replicaId.
*/
@@ -149,7 +149,7 @@ public class RegionReplicaUtil {
if ((newReplicaCount - 1) <= 0) {
return regions;
}
- List<RegionInfo> hRegionInfos = new ArrayList<>((newReplicaCount) * regions.size());
+ List<RegionInfo> hRegionInfos = new ArrayList<>(newReplicaCount * regions.size());
for (RegionInfo ri : regions) {
if (
RegionReplicaUtil.isDefaultReplica(ri)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCoprocessorRpcChannelImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCoprocessorRpcChannelImpl.java
index 76bca140ef1..7b60777e958 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCoprocessorRpcChannelImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCoprocessorRpcChannelImpl.java
@@ -77,11 +77,11 @@ public class RegionServerCoprocessorRpcChannelImpl implements RpcChannel {
Message responsePrototype, RpcCallback<Message> done) {
addListener(
callerBuilder.action((c, s) -> rpcCall(method, request, responsePrototype, c, s)).call(),
- ((r, e) -> {
+ (r, e) -> {
if (e != null) {
((ClientCoprocessorRpcController) controller).setFailed(e);
}
done.run(r);
- }));
+ });
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
index 2ae13c6ce1c..ced6b5ea442 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
@@ -873,6 +873,7 @@ public class Result implements CellScannable, CellScanner {
}
/**
+ * Whether or not the results are partial.
* @deprecated the word 'partial' ambiguous, use {@link #mayHaveMoreCellsInRow()} instead.
* Deprecated since 1.4.0.
* @see #mayHaveMoreCellsInRow()
@@ -904,8 +905,8 @@ public class Result implements CellScannable, CellScanner {
}
/**
- * @return the associated statistics about the region from which this was returned. Can be
- * <tt>null</tt> if stats are disabled.
+ * Returns the associated statistics about the region from which this was returned. Can be
+ * <tt>null</tt> if stats are disabled.
*/
public RegionLoadStats getStats() {
return stats;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallable.java
index 8885069b41a..745aabb143a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallable.java
@@ -46,13 +46,14 @@ public interface RetryingCallable<T> {
void throwable(final Throwable t, boolean retrying);
/**
- * @return Some details from the implementation that we would like to add to a terminating
- * exception; i.e. a fatal exception is being thrown ending retries and we might like to
- * add more implementation-specific detail on to the exception being thrown.
+ * Returns Some details from the implementation that we would like to add to a terminating
+ * exception; i.e. a fatal exception is being thrown ending retries and we might like to add more
+ * implementation-specific detail on to the exception being thrown.
*/
String getExceptionMessageAdditionalDetail();
/**
+ * Sleep and retry.
* @param pause time to pause
* @param tries amount of tries until till sleep
* @return Suggestion on how much to sleep between retries
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Row.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Row.java
index 683304ff758..32d283a2883 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Row.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Row.java
@@ -32,9 +32,11 @@ public interface Row extends Comparable<Row> {
byte[] getRow();
/**
+ * Compare this row to another row.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use
* {@link Row#COMPARATOR} instead
*/
@Deprecated
+ @Override
int compareTo(Row var1);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowAccess.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowAccess.java
index cd1f4756079..1af8798fd87 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowAccess.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowAccess.java
@@ -22,7 +22,6 @@ import org.apache.yetus.audience.InterfaceAudience;
/**
* Provide a way to access the inner buffer. The purpose is to reduce the elapsed time to move a
* large number of elements between collections.
- * @param <T>
*/
@InterfaceAudience.Private
public interface RowAccess<T> extends Iterable<T> {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
index 1d9b94a54cc..b5857fb1364 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
@@ -102,6 +102,7 @@ public class RowMutations implements Row {
}
/**
+ * Add a list of mutations
* @param mutations The data to send.
* @throws IOException if the row of added mutation doesn't match the original row
*/
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java
index 19daacd77a7..a1991378228 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java
@@ -18,7 +18,6 @@
package org.apache.hadoop.hbase.client;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.util.ReflectionUtils;
import org.apache.yetus.audience.InterfaceAudience;
@@ -34,9 +33,6 @@ public class RpcRetryingCallerFactory {
private final ConnectionConfiguration connectionConf;
private final RetryingCallerInterceptor interceptor;
private final int startLogErrorsCnt;
- /* These below data members are UNUSED!!! */
- private final boolean enableBackPressure;
- private ServerStatisticTracker stats;
public RpcRetryingCallerFactory(Configuration conf) {
this(conf, RetryingCallerInterceptorFactory.NO_OP_INTERCEPTOR);
@@ -48,15 +44,6 @@ public class RpcRetryingCallerFactory {
startLogErrorsCnt = conf.getInt(AsyncProcess.START_LOG_ERRORS_AFTER_COUNT_KEY,
AsyncProcess.DEFAULT_START_LOG_ERRORS_AFTER_COUNT);
this.interceptor = interceptor;
- enableBackPressure = conf.getBoolean(HConstants.ENABLE_CLIENT_BACKPRESSURE,
- HConstants.DEFAULT_ENABLE_CLIENT_BACKPRESSURE);
- }
-
- /**
- * Set the tracker that should be used for tracking statistics about the server
- */
- public void setStatisticTracker(ServerStatisticTracker statisticTracker) {
- this.stats = statisticTracker;
}
/**
@@ -102,9 +89,6 @@ public class RpcRetryingCallerFactory {
factory = ReflectionUtils.instantiateWithCustomCtor(rpcCallerFactoryClazz,
new Class[] { Configuration.class }, new Object[] { configuration });
}
-
- // setting for backwards compat with existing caller factories, rather than in the ctor
- factory.setStatisticTracker(stats);
return factory;
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerImpl.java
index 2c82cdd54bc..67b12b8a34b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerImpl.java
@@ -156,7 +156,7 @@ public class RpcRetryingCallerImpl<T> implements RpcRetryingCaller<T> {
if (duration > callTimeout) {
String msg = "callTimeout=" + callTimeout + ", callDuration=" + duration + ": "
+ t.getMessage() + " " + callable.getExceptionMessageAdditionalDetail();
- throw (SocketTimeoutException) (new SocketTimeoutException(msg).initCause(t));
+ throw (SocketTimeoutException) new SocketTimeoutException(msg).initCause(t);
}
} finally {
interceptor.updateFailureInfo(context);
@@ -235,7 +235,7 @@ public class RpcRetryingCallerImpl<T> implements RpcRetryingCaller<T> {
private int getTimeout(int callTimeout) {
int timeout = tracker.getRemainingTime(callTimeout);
- if (timeout <= 0 || rpcTimeout > 0 && rpcTimeout < timeout) {
+ if (timeout <= 0 || (rpcTimeout > 0 && rpcTimeout < timeout)) {
timeout = rpcTimeout;
}
return timeout;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
index d417d8e8453..44ef44b3b67 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
@@ -866,9 +866,9 @@ public class Scan extends Query {
}
/**
- * @return true when the constructor of this scan understands that the results they will see may
- * only represent a partial portion of a row. The entire row would be retrieved by
- * subsequent calls to {@link ResultScanner#next()}
+ * Returns true when the constructor of this scan understands that the results they will see may
+ * only represent a partial portion of a row. The entire row would be retrieved by subsequent
+ * calls to {@link ResultScanner#next()}
*/
public boolean getAllowPartialResults() {
return allowPartialResults;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScanResultConsumer.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScanResultConsumer.java
index b574b2c2bd5..44f8e194045 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScanResultConsumer.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScanResultConsumer.java
@@ -30,8 +30,7 @@ import org.apache.yetus.audience.InterfaceAudience;
public interface ScanResultConsumer extends ScanResultConsumerBase {
/**
- * @param result the data fetched from HBase service.
- * @return {@code false} if you want to terminate the scan process. Otherwise {@code true}
+ * Return {@code false} if you want to terminate the scan process. Otherwise {@code true}
*/
boolean onNext(Result result);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java
index 21653214ce6..fe155136cb2 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java
@@ -262,6 +262,7 @@ class ScannerCallableWithReplicas implements RetryingCallable<Result[]> {
throw new IOException("Imposible? Arrive at an unreachable line...");
}
+ @SuppressWarnings("FutureReturnValueIgnored")
private void updateCurrentlyServingReplica(ScannerCallable scanner, Result[] result,
AtomicBoolean done, ExecutorService pool) {
if (done.compareAndSet(false, true)) {
@@ -308,10 +309,10 @@ class ScannerCallableWithReplicas implements RetryingCallable<Result[]> {
}
/**
- * @return true when the most recent RPC response indicated that the response was a heartbeat
- * message. Heartbeat messages are sent back from the server when the processing of the
- * scan request exceeds a certain time threshold. Heartbeats allow the server to avoid
- * timeouts during long running scan operations.
+ * Returns true when the most recent RPC response indicated that the response was a heartbeat
+ * message. Heartbeat messages are sent back from the server when the processing of the scan
+ * request exceeds a certain time threshold. Heartbeats allow the server to avoid timeouts during
+ * long running scan operations.
*/
public boolean isHeartbeatMessage() {
return currentScannerCallable != null && currentScannerCallable.isHeartbeatMessage();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServiceCaller.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServiceCaller.java
index fc550c880a6..626d8675277 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServiceCaller.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ServiceCaller.java
@@ -27,20 +27,16 @@ import org.apache.yetus.audience.InterfaceAudience;
* Usually, it is just a simple lambda expression, like:
*
* <pre>
- * <code>
- * (stub, controller, rpcCallback) -> {
+ * (stub, controller, rpcCallback) -> {
* XXXRequest request = ...; // prepare the request
* stub.xxx(controller, request, rpcCallback);
* }
- * </code>
* </pre>
*
* And if already have the {@code request}, the lambda expression will be:
*
* <pre>
- * <code>
- * (stub, controller, rpcCallback) -> stub.xxx(controller, request, rpcCallback)
- * </code>
+ * (stub, controller, rpcCallback) -> stub.xxx(controller, request, rpcCallback)
* </pre>
*
* @param <S> the type of the protobuf Service you want to call.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SlowLogParams.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SlowLogParams.java
index 3311539c261..b1460c0b116 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SlowLogParams.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SlowLogParams.java
@@ -62,13 +62,10 @@ public class SlowLogParams {
if (this == o) {
return true;
}
-
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof SlowLogParams)) {
return false;
}
-
SlowLogParams that = (SlowLogParams) o;
-
return new EqualsBuilder().append(regionName, that.regionName).append(params, that.params)
.isEquals();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
index 4cf7a876137..a01735955b5 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
@@ -160,6 +160,7 @@ public class SnapshotDescription {
}
/**
+ * Get the table name as a string.
* @deprecated since 2.0.0 and will be removed in 3.0.0. Use {@link #getTableName()} or
* {@link #getTableNameAsString()} instead.
* @see #getTableName()
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java
index 894b4678908..79d3572cd61 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java
@@ -464,11 +464,13 @@ public interface Table extends Closeable {
interface CheckAndMutateBuilder {
/**
+ * Specify a column qualifer
* @param qualifier column qualifier to check.
*/
CheckAndMutateBuilder qualifier(byte[] qualifier);
/**
+ * Specify a timerange
* @param timeRange timeRange to check
*/
CheckAndMutateBuilder timeRange(TimeRange timeRange);
@@ -487,24 +489,28 @@ public interface Table extends Closeable {
}
/**
+ * Check for match.
* @param compareOp comparison operator to use
* @param value the expected value
*/
CheckAndMutateBuilder ifMatches(CompareOperator compareOp, byte[] value);
/**
+ * Specify a Put to commit if the check succeeds.
* @param put data to put if check succeeds
* @return {@code true} if the new put was executed, {@code false} otherwise.
*/
boolean thenPut(Put put) throws IOException;
/**
+ * Specify a Delete to commit if the check succeeds.
* @param delete data to delete if check succeeds
* @return {@code true} if the new delete was executed, {@code false} otherwise.
*/
boolean thenDelete(Delete delete) throws IOException;
/**
+ * Specify a RowMutations to commit if the check succeeds.
* @param mutation mutations to perform if check succeeds
* @return true if the new mutation was executed, false otherwise.
*/
@@ -541,23 +547,27 @@ public interface Table extends Closeable {
interface CheckAndMutateWithFilterBuilder {
/**
+ * Specify a timerange.
* @param timeRange timeRange to check
*/
CheckAndMutateWithFilterBuilder timeRange(TimeRange timeRange);
/**
+ * Specify a Put to commit if the check succeeds.
* @param put data to put if check succeeds
* @return {@code true} if the new put was executed, {@code false} otherwise.
*/
boolean thenPut(Put put) throws IOException;
/**
+ * Specify a Delete to commit if the check succeeds.
* @param delete data to delete if check succeeds
* @return {@code true} if the new delete was executed, {@code false} otherwise.
*/
boolean thenDelete(Delete delete) throws IOException;
/**
+ * Specify a RowMutations to commit if the check succeeds.
* @param mutation mutations to perform if check succeeds
* @return true if the new mutation was executed, false otherwise.
*/
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptor.java
index ff97f419bac..ca7590112b4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptor.java
@@ -166,11 +166,12 @@ public interface TableDescriptor {
String getRegionSplitPolicyClassName();
/**
- * Get the name of the table n
+ * Get the name of the table
*/
TableName getTableName();
/**
+ * Get the owner name as a string.
* @deprecated since 2.0.0 and will be removed in 3.0.0.
* @see <a href="https://issues.apache.org/jira/browse/HBASE-15583">HBASE-15583</a>
*/
@@ -280,8 +281,8 @@ public interface TableDescriptor {
boolean isReadOnly();
/**
- * @return Name of this table and then a map of all of the column family descriptors (with only
- * the non-default column family attributes)
+ * Returns Name of this table and then a map of all of the column family descriptors (with only
+ * the non-default column family attributes)
*/
String toStringCustomizedValues();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java
index 1d2b69c7146..e2dc4773d8d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java
@@ -148,8 +148,6 @@ public class TableDescriptorBuilder {
private static final Bytes REGION_MEMSTORE_REPLICATION_KEY =
new Bytes(Bytes.toBytes(REGION_MEMSTORE_REPLICATION));
- private static final Bytes REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY =
- new Bytes(Bytes.toBytes(RegionReplicaUtil.REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY));
/**
* Used by shell/rest interface to access this metadata attribute which denotes if the table
* should be treated by region normalizer.
@@ -294,10 +292,7 @@ public class TableDescriptorBuilder {
private final ModifyableTableDescriptor desc;
- /**
- * @param desc The table descriptor to serialize
- * @return This instance serialized with pb with pb magic prefix
- */
+ /** Returns This instance serialized with pb with pb magic prefix */
public static byte[] toByteArray(TableDescriptor desc) {
if (desc instanceof ModifyableTableDescriptor) {
return ((ModifyableTableDescriptor) desc).toByteArray();
@@ -309,7 +304,7 @@ public class TableDescriptorBuilder {
* The input should be created by {@link #toByteArray}.
* @param pbBytes A pb serialized TableDescriptor instance with pb magic prefix
* @return This instance serialized with pb with pb magic prefix
- * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
+ * @throws org.apache.hadoop.hbase.exceptions.DeserializationException if an error occurred
*/
public static TableDescriptor parseFrom(byte[] pbBytes) throws DeserializationException {
return ModifyableTableDescriptor.parseFrom(pbBytes);
@@ -506,6 +501,7 @@ public class TableDescriptorBuilder {
}
/**
+ * Set the table owner
* @deprecated since 2.0.0 and will be removed in 3.0.0.
* @see <a href="https://issues.apache.org/jira/browse/HBASE-15583">HBASE-15583</a>
*/
@@ -516,6 +512,7 @@ public class TableDescriptorBuilder {
}
/**
+ * Set the table owner
* @deprecated since 2.0.0 and will be removed in 3.0.0.
* @see <a href="https://issues.apache.org/jira/browse/HBASE-15583">HBASE-15583</a>
*/
@@ -1511,6 +1508,7 @@ public class TableDescriptorBuilder {
}
/**
+ * Set the table owner
* @deprecated since 2.0.0 and will be removed in 3.0.0.
* @see <a href="https://issues.apache.org/jira/browse/HBASE-15583">HBASE-15583</a>
*/
@@ -1520,6 +1518,7 @@ public class TableDescriptorBuilder {
}
/**
+ * Set the table owner.
* @deprecated since 2.0.0 and will be removed in 3.0.0.
* @see <a href="https://issues.apache.org/jira/browse/HBASE-15583">HBASE-15583</a>
*/
@@ -1530,6 +1529,7 @@ public class TableDescriptorBuilder {
}
/**
+ * Set the table owner.
* @deprecated since 2.0.0 and will be removed in 3.0.0.
* @see <a href="https://issues.apache.org/jira/browse/HBASE-15583">HBASE-15583</a>
*/
@@ -1548,6 +1548,7 @@ public class TableDescriptorBuilder {
}
/**
+ * Parse the serialized representation of a {@link ModifyableTableDescriptor}
* @param bytes A pb serialized {@link ModifyableTableDescriptor} instance with pb magic prefix
* @return An instance of {@link ModifyableTableDescriptor} made from <code>bytes</code> n
* * @see #toByteArray()
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableState.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableState.java
index 6ecd97a75c9..4e20302be45 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableState.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableState.java
@@ -209,15 +209,19 @@ public class TableState {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof TableState)) {
+ return false;
+ }
TableState that = (TableState) o;
-
- if (state != that.state) return false;
- if (tableName != null ? !tableName.equals(that.tableName) : that.tableName != null)
+ if (state != that.state) {
return false;
-
+ }
+ if (tableName != null ? !tableName.equals(that.tableName) : that.tableName != null) {
+ return false;
+ }
return true;
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/backoff/ClientBackoffPolicyFactory.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/backoff/ClientBackoffPolicyFactory.java
index a786702b169..6993a4ac21a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/backoff/ClientBackoffPolicyFactory.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/backoff/ClientBackoffPolicyFactory.java
@@ -22,15 +22,11 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.util.ReflectionUtils;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@InterfaceAudience.Private
@InterfaceStability.Evolving
public final class ClientBackoffPolicyFactory {
- private static final Logger LOG = LoggerFactory.getLogger(ClientBackoffPolicyFactory.class);
-
private ClientBackoffPolicyFactory() {
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/backoff/ExponentialClientBackoffPolicy.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/backoff/ExponentialClientBackoffPolicy.java
index aa84207e1ed..0e3339948ea 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/backoff/ExponentialClientBackoffPolicy.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/backoff/ExponentialClientBackoffPolicy.java
@@ -21,8 +21,6 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.ServerName;
import org.apache.yetus.audience.InterfaceAudience;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
@@ -33,8 +31,6 @@ import org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
@InterfaceAudience.Public
public class ExponentialClientBackoffPolicy implements ClientBackoffPolicy {
- private static final Logger LOG = LoggerFactory.getLogger(ExponentialClientBackoffPolicy.class);
-
private static final long ONE_MINUTE = 60 * 1000;
public static final long DEFAULT_MAX_BACKOFF = 5 * ONE_MINUTE;
public static final String MAX_BACKOFF_KEY = "hbase.client.exponential-backoff.max";
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java
index b7af4a9eff9..18592894076 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java
@@ -78,7 +78,7 @@ public class BigDecimalColumnInterpreter
@Override
public BigDecimal increment(BigDecimal bd) {
- return bd == null ? null : (bd.add(BigDecimal.ONE));
+ return bd == null ? null : bd.add(BigDecimal.ONE);
}
@Override
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java
index 4f94dc67a88..825eec539b1 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java
@@ -37,8 +37,6 @@ import org.apache.hadoop.hbase.replication.ReplicationException;
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
import org.apache.yetus.audience.InterfaceAudience;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
@@ -65,7 +63,6 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
@InterfaceAudience.Public
@Deprecated
public class ReplicationAdmin implements Closeable {
- private static final Logger LOG = LoggerFactory.getLogger(ReplicationAdmin.class);
public static final String TNAME = "tableName";
public static final String CFNAME = "columnFamilyName";
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.java
index 7942d9904de..c5836a99e37 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -112,8 +113,8 @@ public final class ReplicationPeerConfigUtil {
}
ReplicationProtos.TableCF.Builder tableCFBuilder = ReplicationProtos.TableCF.newBuilder();
- String[] tables = tableCFsConfig.split(";");
- List<ReplicationProtos.TableCF> tableCFList = new ArrayList<>(tables.length);
+ List<String> tables = Splitter.on(';').splitToList(tableCFsConfig);
+ List<ReplicationProtos.TableCF> tableCFList = new ArrayList<>(tables.size());
for (String tab : tables) {
// 1 ignore empty table config
@@ -123,9 +124,9 @@ public final class ReplicationPeerConfigUtil {
}
// 2 split to "table" and "cf1,cf2"
// for each table: "table#cf1,cf2" or "table"
- String[] pair = tab.split(":");
- String tabName = pair[0].trim();
- if (pair.length > 2 || tabName.length() == 0) {
+ Iterator<String> i = Splitter.on(':').split(tab).iterator();
+ String tabName = i.next().trim();
+ if (tabName.length() == 0) {
LOG.info("incorrect format:" + tableCFsConfig);
continue;
}
@@ -134,16 +135,17 @@ public final class ReplicationPeerConfigUtil {
// split namespace from tableName
String ns = "default";
String tName = tabName;
- String[] dbs = tabName.split("\\.");
- if (dbs != null && dbs.length == 2) {
- ns = dbs[0];
- tName = dbs[1];
+ List<String> dbs = Splitter.on('.').splitToList(tabName);
+ if (dbs != null && dbs.size() == 2) {
+ Iterator<String> ii = dbs.iterator();
+ ns = ii.next();
+ tName = ii.next();
}
tableCFBuilder.setTableName(ProtobufUtil.toProtoTableName(TableName.valueOf(ns, tName)));
// 3 parse "cf1,cf2" part to List<cf>
- if (pair.length == 2) {
- String[] cfsList = pair[1].split(",");
+ if (i.hasNext()) {
+ List<String> cfsList = Splitter.on(',').splitToList(i.next());
for (String cf : cfsList) {
String cfName = cf.trim();
if (cfName.length() > 0) {
@@ -240,6 +242,7 @@ public final class ReplicationPeerConfigUtil {
}
/**
+ * Parse the serialized representation of a peer configuration.
* @param bytes Content of a peer znode.
* @return ClusterKey parsed from the passed bytes.
* @throws DeserializationException deserialization exception
@@ -377,10 +380,9 @@ public final class ReplicationPeerConfigUtil {
}
/**
- * @param peerConfig peer config of replication peer
- * @return Serialized protobuf of <code>peerConfig</code> with pb magic prefix prepended suitable
- * for use as content of a this.peersZNode; i.e. the content of PEER_ID znode under
- * /hbase/replication/peers/PEER_ID
+ * Returns Serialized protobuf of <code>peerConfig</code> with pb magic prefix prepended suitable
+ * for use as content of a this.peersZNode; i.e. the content of PEER_ID znode under
+ * /hbase/replication/peers/PEER_ID
*/
public static byte[] toByteArray(final ReplicationPeerConfig peerConfig) {
byte[] bytes = convert(peerConfig).toByteArray();
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java
index 5ed2aba2a19..6df88561fdb 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java
@@ -39,11 +39,12 @@ import org.apache.yetus.audience.InterfaceStability;
* {@link ColumnInterpreter#castToReturnType(Object)} which takes a <T> type and returns a
* <S> type. The AggregateIm>lementation uses PB messages to initialize the user's
* ColumnInterpreter implementation, and for sending the responses back to AggregationClient.
- * @param T Cell value data type
- * @param S Promoted data type
- * @param P PB message that is used to transport initializer specific bytes
- * @param Q PB message that is used to transport Cell (<T>) instance
- * @param R PB message that is used to transport Promoted (<S>) instance
+ * <p>
+ * <T> Cell value data type<br>
+ * <S> Promoted data type<br>
+ * <P> PB message that is used to transport initializer specific bytes<br>
+ * <Q> PB message that is used to transport Cell (<T>) instance<br>
+ * <R> PB message that is used to transport Promoted (<S>) instance
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RegionOpeningException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RegionOpeningException.java
index 347c6b987a1..bef80b2cb82 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RegionOpeningException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RegionOpeningException.java
@@ -20,8 +20,6 @@ package org.apache.hadoop.hbase.exceptions;
import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Subclass if the server knows the region is now on another server. This allows the client to call
@@ -30,7 +28,7 @@ import org.slf4j.LoggerFactory;
@InterfaceAudience.Private
@InterfaceStability.Evolving
public class RegionOpeningException extends NotServingRegionException {
- private static final Logger LOG = LoggerFactory.getLogger(RegionOpeningException.class);
+
private static final long serialVersionUID = -7232903522310558395L;
public RegionOpeningException(String message) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BigDecimalComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BigDecimalComparator.java
index 669a591a961..b37bec4fc51 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BigDecimalComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BigDecimalComparator.java
@@ -82,9 +82,10 @@ public class BigDecimalComparator extends ByteArrayComparable {
}
/**
+ * Parse a serialized representation of {@link BigDecimalComparator}
* @param pbBytes A pb serialized {@link BigDecimalComparator} instance
* @return An instance of {@link BigDecimalComparator} made from <code>bytes</code>
- * @throws DeserializationException A deserialization exception
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static BigDecimalComparator parseFrom(final byte[] pbBytes)
@@ -100,10 +101,10 @@ public class BigDecimalComparator extends ByteArrayComparable {
}
/**
- * @param other the other comparator
- * @return true if and only if the fields of the comparator that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
+ @SuppressWarnings("ReferenceEquality")
boolean areSerializedFieldsEqual(BigDecimalComparator other) {
if (other == this) {
return true;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java
index 7aff979f4c2..079cee8e642 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java
@@ -64,9 +64,11 @@ public class BinaryComparator extends org.apache.hadoop.hbase.filter.ByteArrayCo
}
/**
+ * Parse a serialized representation of {@link BinaryComparator}
* @param pbBytes A pb serialized {@link BinaryComparator} instance
- * @return An instance of {@link BinaryComparator} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link BinaryComparator} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static BinaryComparator parseFrom(final byte[] pbBytes) throws DeserializationException {
ComparatorProtos.BinaryComparator proto;
@@ -79,14 +81,17 @@ public class BinaryComparator extends org.apache.hadoop.hbase.filter.ByteArrayCo
}
/**
- * n * @return true if and only if the fields of the comparator that are serialized are equal to
- * the corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(ByteArrayComparable other) {
- if (other == this) return true;
- if (!(other instanceof BinaryComparator)) return false;
-
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof BinaryComparator)) {
+ return false;
+ }
return super.areSerializedFieldsEqual(other);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComponentComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComponentComparator.java
index 88622ed2eba..4d2518d23c3 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComponentComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComponentComparator.java
@@ -84,9 +84,10 @@ public class BinaryComponentComparator extends ByteArrayComparable {
}
/**
+ * Parse a serialized representation of {@link BinaryComponentComparator}
* @param pbBytes A pb serialized {@link BinaryComponentComparator} instance
* @return An instance of {@link BinaryComponentComparator} made from <code>bytes</code>
- * @throws DeserializationException DeserializationException
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static BinaryComponentComparator parseFrom(final byte[] pbBytes)
@@ -101,9 +102,8 @@ public class BinaryComponentComparator extends ByteArrayComparable {
}
/**
- * @param other paramemter to compare against
- * @return true if and only if the fields of the comparator that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(ByteArrayComparable other) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java
index fcf447dcb0c..b9cbcc0826b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java
@@ -68,9 +68,11 @@ public class BinaryPrefixComparator extends ByteArrayComparable {
}
/**
+ * Parse a serialized representation of {@link BinaryPrefixComparator}
* @param pbBytes A pb serialized {@link BinaryPrefixComparator} instance
- * @return An instance of {@link BinaryPrefixComparator} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link BinaryPrefixComparator} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static BinaryPrefixComparator parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -84,14 +86,17 @@ public class BinaryPrefixComparator extends ByteArrayComparable {
}
/**
- * n * @return true if and only if the fields of the comparator that are serialized are equal to
- * the corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(ByteArrayComparable other) {
- if (other == this) return true;
- if (!(other instanceof BinaryPrefixComparator)) return false;
-
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof BinaryPrefixComparator)) {
+ return false;
+ }
return super.areSerializedFieldsEqual(other);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BitComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BitComparator.java
index 8abdcf4e8a6..d19738d5357 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BitComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BitComparator.java
@@ -74,8 +74,11 @@ public class BitComparator extends ByteArrayComparable {
}
/**
+ * Parse a serialized representation of {@link BitComparator}
* @param pbBytes A pb serialized {@link BitComparator} instance
- * @return An instance of {@link BitComparator} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link BitComparator} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static BitComparator parseFrom(final byte[] pbBytes) throws DeserializationException {
ComparatorProtos.BitComparator proto;
@@ -89,14 +92,17 @@ public class BitComparator extends ByteArrayComparable {
}
/**
- * n * @return true if and only if the fields of the comparator that are serialized are equal to
- * the corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(ByteArrayComparable other) {
- if (other == this) return true;
- if (!(other instanceof BitComparator)) return false;
-
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof BitComparator)) {
+ return false;
+ }
BitComparator comparator = (BitComparator) other;
return super.areSerializedFieldsEqual(other)
&& this.getOperator().equals(comparator.getOperator());
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java
index a7cd0489ca5..c3bcfd80cce 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java
@@ -94,8 +94,10 @@ public class ColumnCountGetFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link ColumnCountGetFilter}
* @param pbBytes A pb serialized {@link ColumnCountGetFilter} instance
* @return An instance of {@link ColumnCountGetFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static ColumnCountGetFilter parseFrom(final byte[] pbBytes)
@@ -110,15 +112,17 @@ public class ColumnCountGetFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof ColumnCountGetFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof ColumnCountGetFilter)) {
+ return false;
+ }
ColumnCountGetFilter other = (ColumnCountGetFilter) o;
return this.getLimit() == other.getLimit();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnPaginationFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnPaginationFilter.java
index e9cf7dce76d..03aa19f83c1 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnPaginationFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnPaginationFilter.java
@@ -78,23 +78,14 @@ public class ColumnPaginationFilter extends FilterBase {
this.columnOffset = columnOffset;
}
- /**
- * n
- */
public int getLimit() {
return limit;
}
- /**
- * n
- */
public int getOffset() {
return offset;
}
- /**
- * n
- */
public byte[] getColumnOffset() {
return columnOffset;
}
@@ -173,9 +164,11 @@ public class ColumnPaginationFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link ColumnPaginationFilter}
* @param pbBytes A pb serialized {@link ColumnPaginationFilter} instance
- * @return An instance of {@link ColumnPaginationFilter} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link ColumnPaginationFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static ColumnPaginationFilter parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -192,15 +185,17 @@ public class ColumnPaginationFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof ColumnPaginationFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof ColumnPaginationFilter)) {
+ return false;
+ }
ColumnPaginationFilter other = (ColumnPaginationFilter) o;
if (this.columnOffset != null) {
return this.getLimit() == other.getLimit()
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java
index de76b8c5059..757b52138fc 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnPrefixFilter.java
@@ -117,9 +117,10 @@ public class ColumnPrefixFilter extends FilterBase {
}
/**
+ * Parses a serialized representation of the {@link ColumnPrefixFilter}
* @param pbBytes A pb serialized {@link ColumnPrefixFilter} instance
* @return An instance of {@link ColumnPrefixFilter} made from <code>bytes</code>
- * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static ColumnPrefixFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
@@ -133,15 +134,17 @@ public class ColumnPrefixFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof ColumnPrefixFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof ColumnPrefixFilter)) {
+ return false;
+ }
ColumnPrefixFilter other = (ColumnPrefixFilter) o;
return Bytes.equals(this.getPrefix(), other.getPrefix());
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnRangeFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnRangeFilter.java
index 1abd49fff3c..23895684682 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnRangeFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnRangeFilter.java
@@ -163,9 +163,11 @@ public class ColumnRangeFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link ColumnRangeFilter}
* @param pbBytes A pb serialized {@link ColumnRangeFilter} instance
- * @return An instance of {@link ColumnRangeFilter} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link ColumnRangeFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static ColumnRangeFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.ColumnRangeFilter proto;
@@ -181,9 +183,8 @@ public class ColumnRangeFilter extends FilterBase {
}
/**
- * @param o filter to serialize.
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnValueFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnValueFilter.java
index 0b3b85dbb47..e7c06d44aef 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnValueFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnValueFilter.java
@@ -168,10 +168,11 @@ public class ColumnValueFilter extends FilterBase {
}
/**
- * Parse protobuf bytes to a ColumnValueFilter
- * @param pbBytes pbBytes
- * @return a ColumnValueFilter
- * @throws DeserializationException deserialization exception
+ * Parse a serialized representation of {@link ColumnValueFilter}
+ * @param pbBytes A pb serialized {@link ColumnValueFilter} instance
+ * @return An instance of {@link ColumnValueFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static ColumnValueFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.ColumnValueFilter proto;
@@ -198,6 +199,10 @@ public class ColumnValueFilter extends FilterBase {
return convert().toByteArray();
}
+ /**
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
+ */
@Override
boolean areSerializedFieldsEqual(Filter o) {
if (o == this) {
@@ -205,7 +210,6 @@ public class ColumnValueFilter extends FilterBase {
} else if (!(o instanceof ColumnValueFilter)) {
return false;
}
-
ColumnValueFilter other = (ColumnValueFilter) o;
return Bytes.equals(this.getFamily(), other.getFamily())
&& Bytes.equals(this.getQualifier(), other.getQualifier())
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/CompareFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/CompareFilter.java
index 5b25e3b2ae1..0a54e991e30 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/CompareFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/CompareFilter.java
@@ -257,7 +257,7 @@ public abstract class CompareFilter extends FilterBase {
}
}
- // returns an array of heterogeneous objects
+ /** Returns an array of heterogeneous objects */
public static ArrayList<Object> extractArguments(ArrayList<byte[]> filterArguments) {
Preconditions.checkArgument(filterArguments.size() == 2, "Expected 2 but got: %s",
filterArguments.size());
@@ -287,13 +287,17 @@ public abstract class CompareFilter extends FilterBase {
}
/**
- * n * @return true if and only if the fields of the filter that are serialized are equal to the
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
* corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof CompareFilter)) return false;
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof CompareFilter)) {
+ return false;
+ }
CompareFilter other = (CompareFilter) o;
return this.getCompareOperator().equals(other.getCompareOperator())
&& (this.getComparator() == other.getComparator()
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/DependentColumnFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/DependentColumnFilter.java
index 0a39f4c94f2..be59929dfc4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/DependentColumnFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/DependentColumnFilter.java
@@ -230,9 +230,11 @@ public class DependentColumnFilter extends CompareFilter {
}
/**
+ * Parse a seralized representation of {@link DependentColumnFilter}
* @param pbBytes A pb serialized {@link DependentColumnFilter} instance
- * @return An instance of {@link DependentColumnFilter} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link DependentColumnFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static DependentColumnFilter parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -259,16 +261,19 @@ public class DependentColumnFilter extends CompareFilter {
}
/**
- * n * @return true if and only if the fields of the filter that are serialized are equal to the
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
* corresponding fields in other. Used for testing.
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof DependentColumnFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof DependentColumnFilter)) {
+ return false;
+ }
DependentColumnFilter other = (DependentColumnFilter) o;
return other != null && super.areSerializedFieldsEqual(other)
&& Bytes.equals(this.getFamily(), other.getFamily())
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FamilyFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FamilyFilter.java
index 917ac522de1..a5c6c8d266a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FamilyFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FamilyFilter.java
@@ -101,8 +101,11 @@ public class FamilyFilter extends CompareFilter {
}
/**
+ * Parse the serialized representation of {@link FamilyFilter}
* @param pbBytes A pb serialized {@link FamilyFilter} instance
- * @return An instance of {@link FamilyFilter} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link FamilyFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static FamilyFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.FamilyFilter proto;
@@ -125,14 +128,17 @@ public class FamilyFilter extends CompareFilter {
}
/**
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof FamilyFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof FamilyFilter)) {
+ return false;
+ }
FamilyFilter other = (FamilyFilter) o;
return super.areSerializedFieldsEqual(other);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/Filter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/Filter.java
index 9df8a6f14f3..cac538dcb8a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/Filter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/Filter.java
@@ -241,7 +241,9 @@ public abstract class Filter {
* Concrete implementers can signal a failure condition in their code by throwing an
* {@link IOException}.
* @param pbBytes A pb serialized {@link Filter} instance
- * @return An instance of {@link Filter} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link Filter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static Filter parseFrom(final byte[] pbBytes) throws DeserializationException {
throw new DeserializationException(
@@ -252,7 +254,6 @@ public abstract class Filter {
* Concrete implementers can signal a failure condition in their code by throwing an
* {@link IOException}. n * @return true if and only if the fields of the filter that are
* serialized are equal to the corresponding fields in other. Used for testing.
- * @throws IOException in case an I/O or an filter specific failure needs to be signaled.
*/
abstract boolean areSerializedFieldsEqual(Filter other);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
index 35313837843..1e00f08757f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
@@ -205,8 +205,11 @@ final public class FilterList extends FilterBase {
}
/**
+ * Parse a seralized representation of {@link FilterList}
* @param pbBytes A pb serialized {@link FilterList} instance
- * @return An instance of {@link FilterList} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link FilterList} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static FilterList parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.FilterList proto;
@@ -229,14 +232,17 @@ final public class FilterList extends FilterBase {
}
/**
- * n * @return true if and only if the fields of the filter that are serialized are equal to the
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
* corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter other) {
- if (other == this) return true;
- if (!(other instanceof FilterList)) return false;
-
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof FilterList)) {
+ return false;
+ }
FilterList o = (FilterList) other;
return this.getOperator().equals(o.getOperator())
&& ((this.getFilters() == o.getFilters()) || this.getFilters().equals(o.getFilters()));
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithAND.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithAND.java
index 6ea8e14257c..7347ca3357d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithAND.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithAND.java
@@ -285,12 +285,12 @@ public class FilterListWithAND extends FilterListBase {
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof FilterListWithAND)) {
- return false;
- }
if (this == obj) {
return true;
}
+ if (!(obj instanceof FilterListWithAND)) {
+ return false;
+ }
FilterListWithAND f = (FilterListWithAND) obj;
return this.filters.equals(f.getFilters()) && this.seekHintFilters.equals(f.seekHintFilters);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java
index 690b32babba..5bc1a151e83 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java
@@ -409,12 +409,12 @@ public class FilterListWithOR extends FilterListBase {
@Override
public boolean equals(Object obj) {
- if (obj == null || (!(obj instanceof FilterListWithOR))) {
- return false;
- }
if (this == obj) {
return true;
}
+ if (!(obj instanceof FilterListWithOR)) {
+ return false;
+ }
FilterListWithOR f = (FilterListWithOR) obj;
return this.filters.equals(f.getFilters()) && this.prevFilterRCList.equals(f.prevFilterRCList)
&& this.prevCellList.equals(f.prevCellList);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
index d779d36eef7..1b9f277814b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
@@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.yetus.audience.InterfaceAudience;
@@ -77,6 +76,7 @@ public class FirstKeyOnlyFilter extends FilterBase {
}
/**
+ * Set or clear the indication if the first KV has been found.
* @param value update {@link #foundKV} flag with value.
*/
protected void setFoundKV(boolean value) {
@@ -91,9 +91,10 @@ public class FirstKeyOnlyFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link FirstKeyOnlyFilter}
* @param pbBytes A pb serialized {@link FirstKeyOnlyFilter} instance
* @return An instance of {@link FirstKeyOnlyFilter} made from <code>bytes</code>
- * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static FirstKeyOnlyFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
@@ -108,15 +109,17 @@ public class FirstKeyOnlyFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof FirstKeyOnlyFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof FirstKeyOnlyFilter)) {
+ return false;
+ }
return true;
}
@@ -127,6 +130,6 @@ public class FirstKeyOnlyFilter extends FilterBase {
@Override
public int hashCode() {
- return Objects.hashCode(foundKV);
+ return Boolean.hashCode(foundKV);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyValueMatchingQualifiersFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyValueMatchingQualifiersFilter.java
index b49e51f348c..95f35c6f674 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyValueMatchingQualifiersFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyValueMatchingQualifiersFilter.java
@@ -95,9 +95,12 @@ public class FirstKeyValueMatchingQualifiersFilter extends FirstKeyOnlyFilter {
}
/**
+ * Parses a serialized representation of {@link FirstKeyValueMatchingQualifiersFilter}
* @param pbBytes A pb serialized {@link FirstKeyValueMatchingQualifiersFilter} instance
* @return An instance of {@link FirstKeyValueMatchingQualifiersFilter} made from
- * <code>bytes</code> n * @see #toByteArray
+ * <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static FirstKeyValueMatchingQualifiersFilter parseFrom(final byte[] pbBytes)
throws DeserializationException {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
index 6036aebdd57..36c1fe2cffa 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
@@ -299,9 +299,11 @@ public class FuzzyRowFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link FuzzyRowFilter}
* @param pbBytes A pb serialized {@link FuzzyRowFilter} instance
- * @return An instance of {@link FuzzyRowFilter} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link FuzzyRowFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static FuzzyRowFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.FuzzyRowFilter proto;
@@ -379,7 +381,7 @@ public class FuzzyRowFilter extends FilterBase {
long fuzzyBytes = Bytes.toLong(fuzzyKeyBytes, i);
long fuzzyMeta = Bytes.toLong(fuzzyKeyMeta, i);
long rowValue = Bytes.toLong(row, offset + i);
- if ((rowValue & fuzzyMeta) != (fuzzyBytes)) {
+ if ((rowValue & fuzzyMeta) != fuzzyBytes) {
// We always return NEXT_EXISTS
return SatisfiesCode.NEXT_EXISTS;
}
@@ -391,7 +393,7 @@ public class FuzzyRowFilter extends FilterBase {
int fuzzyBytes = Bytes.toInt(fuzzyKeyBytes, off);
int fuzzyMeta = Bytes.toInt(fuzzyKeyMeta, off);
int rowValue = Bytes.toInt(row, offset + off);
- if ((rowValue & fuzzyMeta) != (fuzzyBytes)) {
+ if ((rowValue & fuzzyMeta) != fuzzyBytes) {
// We always return NEXT_EXISTS
return SatisfiesCode.NEXT_EXISTS;
}
@@ -402,7 +404,7 @@ public class FuzzyRowFilter extends FilterBase {
short fuzzyBytes = Bytes.toShort(fuzzyKeyBytes, off);
short fuzzyMeta = Bytes.toShort(fuzzyKeyMeta, off);
short rowValue = Bytes.toShort(row, offset + off);
- if ((rowValue & fuzzyMeta) != (fuzzyBytes)) {
+ if ((rowValue & fuzzyMeta) != fuzzyBytes) {
// We always return NEXT_EXISTS
// even if it does not (in this case getNextForFuzzyRule
// will return null)
@@ -415,7 +417,7 @@ public class FuzzyRowFilter extends FilterBase {
int fuzzyBytes = fuzzyKeyBytes[off] & 0xff;
int fuzzyMeta = fuzzyKeyMeta[off] & 0xff;
int rowValue = row[offset + off] & 0xff;
- if ((rowValue & fuzzyMeta) != (fuzzyBytes)) {
+ if ((rowValue & fuzzyMeta) != fuzzyBytes) {
// We always return NEXT_EXISTS
return SatisfiesCode.NEXT_EXISTS;
}
@@ -645,14 +647,17 @@ public class FuzzyRowFilter extends FilterBase {
}
/**
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof FuzzyRowFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof FuzzyRowFilter)) {
+ return false;
+ }
FuzzyRowFilter other = (FuzzyRowFilter) o;
if (this.fuzzyKeysData.size() != other.fuzzyKeysData.size()) return false;
for (int i = 0; i < fuzzyKeysData.size(); ++i) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java
index 67a214e5650..43204211bfb 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java
@@ -92,9 +92,11 @@ public class InclusiveStopFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link InclusiveStopFilter}
* @param pbBytes A pb serialized {@link InclusiveStopFilter} instance
- * @return An instance of {@link InclusiveStopFilter} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link InclusiveStopFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static InclusiveStopFilter parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -109,15 +111,17 @@ public class InclusiveStopFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof InclusiveStopFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof InclusiveStopFilter)) {
+ return false;
+ }
InclusiveStopFilter other = (InclusiveStopFilter) o;
return Bytes.equals(this.getStopRowKey(), other.getStopRowKey());
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java
index 60b3a5c0480..ff17b0c681d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java
@@ -108,8 +108,11 @@ public class KeyOnlyFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link KeyOnlyFilter}
* @param pbBytes A pb serialized {@link KeyOnlyFilter} instance
- * @return An instance of {@link KeyOnlyFilter} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link KeyOnlyFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static KeyOnlyFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.KeyOnlyFilter proto;
@@ -122,15 +125,17 @@ public class KeyOnlyFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof KeyOnlyFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof KeyOnlyFilter)) {
+ return false;
+ }
KeyOnlyFilter other = (KeyOnlyFilter) o;
return this.lenAsVal == other.lenAsVal;
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
index 8f9a7f1dfc3..c71afa098fe 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
@@ -62,9 +62,10 @@ public class LongComparator extends ByteArrayComparable {
}
/**
+ * Parses a serialized representation of {@link LongComparator}
* @param pbBytes A pb serialized {@link LongComparator} instance
* @return An instance of {@link LongComparator} made from <code>bytes</code>
- * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static LongComparator parseFrom(final byte[] pbBytes) throws DeserializationException {
@@ -78,11 +79,16 @@ public class LongComparator extends ByteArrayComparable {
}
/**
- * n * @return true if and only if the fields of the comparator that are serialized are equal to
- * the corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
boolean areSerializedFieldsEqual(LongComparator other) {
- if (other == this) return true;
+ if (other == this) {
+ return true;
+ }
+ if (other == null) {
+ return false;
+ }
return super.areSerializedFieldsEqual(other);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
index af07cc42b11..cc9abbc2293 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
@@ -203,9 +203,11 @@ public class MultiRowRangeFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link MultiRowRangeFilter}
* @param pbBytes A pb serialized instance
- * @return An instance of MultiRowRangeFilter
- * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
+ * @return An instance of {@link MultiRowRangeFilter}
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static MultiRowRangeFilter parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -230,15 +232,17 @@ public class MultiRowRangeFilter extends FilterBase {
}
/**
- * @param o the filter to compare
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof MultiRowRangeFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof MultiRowRangeFilter)) {
+ return false;
+ }
MultiRowRangeFilter other = (MultiRowRangeFilter) o;
if (this.rangeList.size() != other.rangeList.size()) return false;
for (int i = 0; i < rangeList.size(); ++i) {
@@ -725,7 +729,7 @@ public class MultiRowRangeFilter extends FilterBase {
/**
* Gets the RowRange at the given offset.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "TypeParameterUnusedInFormals" })
public <T extends BasicRowRange> T get(int i) {
return (T) ranges.get(i);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
index e7c868e3bbb..ed061a5756f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
@@ -134,9 +134,11 @@ public class MultipleColumnPrefixFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link MultipleColumnPrefixFilter}
* @param pbBytes A pb serialized {@link MultipleColumnPrefixFilter} instance
- * @return An instance of {@link MultipleColumnPrefixFilter} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link MultipleColumnPrefixFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static MultipleColumnPrefixFilter parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -156,15 +158,17 @@ public class MultipleColumnPrefixFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof MultipleColumnPrefixFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof MultipleColumnPrefixFilter)) {
+ return false;
+ }
MultipleColumnPrefixFilter other = (MultipleColumnPrefixFilter) o;
return this.sortedPrefixes.equals(other.sortedPrefixes);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java
index 6153e1e8080..ea8a5abd354 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java
@@ -71,9 +71,11 @@ public class NullComparator extends ByteArrayComparable {
}
/**
+ * Parse the serialized representation of {@link NullComparator}
* @param pbBytes A pb serialized {@link NullComparator} instance
- * @return An instance of {@link NullComparator} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link NullComparator} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static NullComparator parseFrom(final byte[] pbBytes) throws DeserializationException {
try {
@@ -86,14 +88,17 @@ public class NullComparator extends ByteArrayComparable {
}
/**
- * n * @return true if and only if the fields of the comparator that are serialized are equal to
- * the corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(ByteArrayComparable other) {
- if (other == this) return true;
- if (!(other instanceof NullComparator)) return false;
-
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof NullComparator)) {
+ return false;
+ }
return super.areSerializedFieldsEqual(other);
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java
index 45c8a1f1a3f..dd6f4eca405 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java
@@ -106,8 +106,11 @@ public class PageFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link PageFilter}
* @param pbBytes A pb serialized {@link PageFilter} instance
- * @return An instance of {@link PageFilter} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link PageFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static PageFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.PageFilter proto;
@@ -120,9 +123,8 @@ public class PageFilter extends FilterBase {
}
/**
- * @param o other Filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ParseFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ParseFilter.java
index c9ebace2da2..b4f24ef97d0 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ParseFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ParseFilter.java
@@ -157,7 +157,7 @@ public class ParseFilter {
operatorStack.pop();
continue;
}
- while (!(argumentOnTopOfStack.equals(ParseConstants.LPAREN_BUFFER))) {
+ while (!argumentOnTopOfStack.equals(ParseConstants.LPAREN_BUFFER)) {
filterStack.push(popArguments(operatorStack, filterStack));
if (operatorStack.empty()) {
throw new IllegalArgumentException("Mismatched parenthesis");
@@ -242,17 +242,12 @@ public class ParseFilter {
Class<?>[] argTypes = new Class[] { ArrayList.class };
Method m = c.getDeclaredMethod("createFilterFromArguments", argTypes);
return (Filter) m.invoke(null, filterArguments);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
+ } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException
+ | InvocationTargetException e) {
+ LOG.warn("Exception while invoking createFilterFromArguments", e);
+ throw new IllegalArgumentException(
+ "Incorrect filter string " + new String(filterStringAsByteArray, StandardCharsets.UTF_8));
}
- throw new IllegalArgumentException(
- "Incorrect filter string " + new String(filterStringAsByteArray, StandardCharsets.UTF_8));
}
/**
@@ -367,7 +362,7 @@ public class ParseFilter {
public void reduce(Stack<ByteBuffer> operatorStack, Stack<Filter> filterStack,
ByteBuffer operator) {
while (
- !operatorStack.empty() && !(ParseConstants.LPAREN_BUFFER.equals(operatorStack.peek()))
+ !operatorStack.empty() && !ParseConstants.LPAREN_BUFFER.equals(operatorStack.peek())
&& hasHigherPriority(operatorStack.peek(), operator)
) {
filterStack.push(popArguments(operatorStack, filterStack));
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java
index 51752d2b72f..711b6d59944 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java
@@ -116,9 +116,10 @@ public class PrefixFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link PrefixFilter}
* @param pbBytes A pb serialized {@link PrefixFilter} instance
* @return An instance of {@link PrefixFilter} made from <code>bytes</code>
- * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static PrefixFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
@@ -132,15 +133,17 @@ public class PrefixFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof PrefixFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof PrefixFilter)) {
+ return false;
+ }
PrefixFilter other = (PrefixFilter) o;
return Bytes.equals(this.getPrefix(), other.getPrefix());
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/QualifierFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/QualifierFilter.java
index 7f0b8642003..328c7fd57c6 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/QualifierFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/QualifierFilter.java
@@ -95,9 +95,10 @@ public class QualifierFilter extends CompareFilter {
}
/**
+ * Parse a serialized representation of {@link QualifierFilter}
* @param pbBytes A pb serialized {@link QualifierFilter} instance
* @return An instance of {@link QualifierFilter} made from <code>bytes</code>
- * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static QualifierFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
@@ -121,14 +122,17 @@ public class QualifierFilter extends CompareFilter {
}
/**
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof QualifierFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof QualifierFilter)) {
+ return false;
+ }
return super.areSerializedFieldsEqual(o);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RandomRowFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RandomRowFilter.java
index 656ceaf3e1a..f7e0281b112 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RandomRowFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RandomRowFilter.java
@@ -114,9 +114,11 @@ public class RandomRowFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link RandomRowFilter}
* @param pbBytes A pb serialized {@link RandomRowFilter} instance
- * @return An instance of {@link RandomRowFilter} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link RandomRowFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static RandomRowFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.RandomRowFilter proto;
@@ -129,15 +131,17 @@ public class RandomRowFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof RandomRowFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof RandomRowFilter)) {
+ return false;
+ }
RandomRowFilter other = (RandomRowFilter) o;
return this.getChance() == other.getChance();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java
index 4bdc057bd9e..9efa563b432 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java
@@ -152,9 +152,11 @@ public class RegexStringComparator extends ByteArrayComparable {
}
/**
+ * Parse a serialized representation of {@link RegexStringComparator}
* @param pbBytes A pb serialized {@link RegexStringComparator} instance
- * @return An instance of {@link RegexStringComparator} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link RegexStringComparator} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static RegexStringComparator parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -183,13 +185,17 @@ public class RegexStringComparator extends ByteArrayComparable {
}
/**
- * n * @return true if and only if the fields of the comparator that are serialized are equal to
- * the corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(ByteArrayComparable other) {
- if (other == this) return true;
- if (!(other instanceof RegexStringComparator)) return false;
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof RegexStringComparator)) {
+ return false;
+ }
RegexStringComparator comparator = (RegexStringComparator) other;
return super.areSerializedFieldsEqual(comparator)
&& engine.getClass().isInstance(comparator.getEngine())
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RowFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RowFilter.java
index fdefe382439..cdebf0a15dc 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RowFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RowFilter.java
@@ -115,8 +115,11 @@ public class RowFilter extends CompareFilter {
}
/**
+ * Parse a serialized representation of {@link RowFilter}
* @param pbBytes A pb serialized {@link RowFilter} instance
- * @return An instance of {@link RowFilter} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link RowFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static RowFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.RowFilter proto;
@@ -139,14 +142,17 @@ public class RowFilter extends CompareFilter {
}
/**
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof RowFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof RowFilter)) {
+ return false;
+ }
return super.areSerializedFieldsEqual(o);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueExcludeFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueExcludeFilter.java
index bbd8ec67994..d3f65efac4a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueExcludeFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueExcludeFilter.java
@@ -173,9 +173,11 @@ public class SingleColumnValueExcludeFilter extends SingleColumnValueFilter {
}
/**
+ * Parse a serialized representation of {@link SingleColumnValueExcludeFilter}
* @param pbBytes A pb serialized {@link SingleColumnValueExcludeFilter} instance
- * @return An instance of {@link SingleColumnValueExcludeFilter} made from <code>bytes</code> n
- * * @see #toByteArray
+ * @return An instance of {@link SingleColumnValueExcludeFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static SingleColumnValueExcludeFilter parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -202,14 +204,17 @@ public class SingleColumnValueExcludeFilter extends SingleColumnValueFilter {
}
/**
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof SingleColumnValueExcludeFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof SingleColumnValueExcludeFilter)) {
+ return false;
+ }
return super.areSerializedFieldsEqual(o);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.java
index a68fdcd0577..7048563d0d6 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.java
@@ -357,8 +357,10 @@ public class SingleColumnValueFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link SingleColumnValueFilter}
* @param pbBytes A pb serialized {@link SingleColumnValueFilter} instance
* @return An instance of {@link SingleColumnValueFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static SingleColumnValueFilter parseFrom(final byte[] pbBytes)
@@ -385,8 +387,8 @@ public class SingleColumnValueFilter extends FilterBase {
}
/**
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java
index 4b23a87537d..1fca852d558 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java
@@ -111,8 +111,11 @@ public class SkipFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link SkipFilter}
* @param pbBytes A pb serialized {@link SkipFilter} instance
- * @return An instance of {@link SkipFilter} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link SkipFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static SkipFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.SkipFilter proto;
@@ -129,15 +132,17 @@ public class SkipFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof SkipFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof SkipFilter)) {
+ return false;
+ }
SkipFilter other = (SkipFilter) o;
return getFilter().areSerializedFieldsEqual(other.getFilter());
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SubstringComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SubstringComparator.java
index b5fe22dca24..8312d3f673f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SubstringComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/SubstringComparator.java
@@ -76,9 +76,11 @@ public class SubstringComparator extends ByteArrayComparable {
}
/**
+ * Parse a serialized representation of {@link SubstringComparator}
* @param pbBytes A pb serialized {@link SubstringComparator} instance
- * @return An instance of {@link SubstringComparator} made from <code>bytes</code> n * @see
- * #toByteArray
+ * @return An instance of {@link SubstringComparator} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static SubstringComparator parseFrom(final byte[] pbBytes)
throws DeserializationException {
@@ -92,14 +94,17 @@ public class SubstringComparator extends ByteArrayComparable {
}
/**
- * n * @return true if and only if the fields of the comparator that are serialized are equal to
- * the corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the comparator that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(ByteArrayComparable other) {
- if (other == this) return true;
- if (!(other instanceof SubstringComparator)) return false;
-
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof SubstringComparator)) {
+ return false;
+ }
SubstringComparator comparator = (SubstringComparator) other;
return super.areSerializedFieldsEqual(comparator) && this.substr.equals(comparator.substr);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/TimestampsFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/TimestampsFilter.java
index eaeaaac3df1..5b3153649e0 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/TimestampsFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/TimestampsFilter.java
@@ -173,8 +173,10 @@ public class TimestampsFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link TimestampsFilter}
* @param pbBytes A pb serialized {@link TimestampsFilter} instance
* @return An instance of {@link TimestampsFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static TimestampsFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
@@ -189,15 +191,17 @@ public class TimestampsFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof TimestampsFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof TimestampsFilter)) {
+ return false;
+ }
TimestampsFilter other = (TimestampsFilter) o;
return this.getTimestamps().equals(other.getTimestamps());
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ValueFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ValueFilter.java
index e726d88f720..5339530923f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ValueFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ValueFilter.java
@@ -96,8 +96,11 @@ public class ValueFilter extends CompareFilter {
}
/**
+ * Parse a serialized representation of {@link ValueFilter}
* @param pbBytes A pb serialized {@link ValueFilter} instance
- * @return An instance of {@link ValueFilter} made from <code>bytes</code> n * @see #toByteArray
+ * @return An instance of {@link ValueFilter} made from <code>bytes</code>
+ * @throws DeserializationException if an error occurred
+ * @see #toByteArray
*/
public static ValueFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.ValueFilter proto;
@@ -120,14 +123,17 @@ public class ValueFilter extends CompareFilter {
}
/**
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Returns true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof ValueFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof ValueFilter)) {
+ return false;
+ }
return super.areSerializedFieldsEqual(o);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java
index e31cbb97378..61433e4b509 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java
@@ -116,9 +116,10 @@ public class WhileMatchFilter extends FilterBase {
}
/**
+ * Parse a serialized representation of {@link WhileMatchFilter}
* @param pbBytes A pb serialized {@link WhileMatchFilter} instance
* @return An instance of {@link WhileMatchFilter} made from <code>bytes</code>
- * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
+ * @throws DeserializationException if an error occurred
* @see #toByteArray
*/
public static WhileMatchFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
@@ -136,15 +137,17 @@ public class WhileMatchFilter extends FilterBase {
}
/**
- * @param o the other filter to compare with
- * @return true if and only if the fields of the filter that are serialized are equal to the
- * corresponding fields in other. Used for testing.
+ * Return true if and only if the fields of the filter that are serialized are equal to the
+ * corresponding fields in other. Used for testing.
*/
@Override
boolean areSerializedFieldsEqual(Filter o) {
- if (o == this) return true;
- if (!(o instanceof WhileMatchFilter)) return false;
-
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof WhileMatchFilter)) {
+ return false;
+ }
WhileMatchFilter other = (WhileMatchFilter) o;
return getFilter().areSerializedFieldsEqual(other.getFilter());
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/package-info.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/package-info.java
index 9dea2548ea9..e4d3ab947da 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/package-info.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/package-info.java
@@ -20,15 +20,14 @@
/**
* Provides row-level filters applied to HRegion scan results during calls to
* {@link org.apache.hadoop.hbase.client.ResultScanner#next()}.
-
-<p>
-Filters run the extent of a table unless you wrap your filter in a
-{@link org.apache.hadoop.hbase.filter.WhileMatchFilter}.
-The latter returns as soon as the filter stops matching.
-</p>
-<p>Do not rely on filters carrying state across rows; its not reliable in current
-hbase as we have no handlers in place for when regions split, close or server
-crashes.
-</p>
-*/
+ *
+ * <p>
+ * Filters run the extent of a table unless you wrap your filter in a
+ * {@link org.apache.hadoop.hbase.filter.WhileMatchFilter}.
+ * The latter returns as soon as the filter stops matching.
+ * </p>
+ * <p>Do not rely on filters carrying state across rows; its not reliable in current
+ * hbase as we have no handlers in place for when regions split, close or server
+ * crashes.
+ */
package org.apache.hadoop.hbase.filter;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java
index 7c0149ccb8a..9d557a98743 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/AbstractRpcClient.java
@@ -238,7 +238,8 @@ public abstract class AbstractRpcClient<T extends RpcConnection> implements RpcC
return null;
}
try {
- return (Codec) Class.forName(className).getDeclaredConstructor().newInstance();
+ return Class.forName(className).asSubclass(Codec.class).getDeclaredConstructor()
+ .newInstance();
} catch (Exception e) {
throw new RuntimeException("Failed getting codec " + className, e);
}
@@ -265,7 +266,8 @@ public abstract class AbstractRpcClient<T extends RpcConnection> implements RpcC
return null;
}
try {
- return (CompressionCodec) Class.forName(className).getDeclaredConstructor().newInstance();
+ return Class.forName(className).asSubclass(CompressionCodec.class).getDeclaredConstructor()
+ .newInstance();
} catch (Exception e) {
throw new RuntimeException("Failed getting compressor " + className, e);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java
index c8adc6a8cc3..da032cbeb9d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java
@@ -67,7 +67,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.protobuf.Message;
-import org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder;
import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
import org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf;
import org.apache.hbase.thirdparty.io.netty.buffer.PooledByteBufAllocator;
@@ -181,6 +180,8 @@ class BlockingRpcConnection extends RpcConnection implements Runnable {
try {
BlockingRpcConnection.this.wait();
} catch (InterruptedException e) {
+ // Restore interrupt status
+ Thread.currentThread().interrupt();
}
// check if we need to quit, so continue the main loop instead of fallback.
continue;
@@ -333,6 +334,8 @@ class BlockingRpcConnection extends RpcConnection implements Runnable {
try {
wait(Math.min(this.rpcClient.minIdleTimeBeforeClose, 1000));
} catch (InterruptedException e) {
+ // Restore interrupt status
+ Thread.currentThread().interrupt();
}
}
}
@@ -685,7 +688,7 @@ class BlockingRpcConnection extends RpcConnection implements Runnable {
} else {
Message value = null;
if (call.responseDefaultType != null) {
- Builder builder = call.responseDefaultType.newBuilderForType();
+ Message.Builder builder = call.responseDefaultType.newBuilderForType();
ProtobufUtil.mergeDelimitedFrom(builder, in);
value = builder.build();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BufferCallBeforeInitHandler.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BufferCallBeforeInitHandler.java
index 3dc48ce3e00..53ac3d86fe5 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BufferCallBeforeInitHandler.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BufferCallBeforeInitHandler.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.ipc;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import org.apache.hadoop.hbase.util.NettyFutureUtils;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hbase.thirdparty.io.netty.channel.ChannelDuplexHandler;
@@ -73,7 +74,7 @@ class BufferCallBeforeInitHandler extends ChannelDuplexHandler {
// We will fail the call directly if we can not write it out.
promise.trySuccess();
} else {
- ctx.write(msg, promise);
+ NettyFutureUtils.consume(ctx.write(msg, promise));
}
}
@@ -84,7 +85,7 @@ class BufferCallBeforeInitHandler extends ChannelDuplexHandler {
switch (bcEvt.action) {
case FLUSH:
for (Call call : id2Call.values()) {
- ctx.write(call);
+ NettyFutureUtils.safeWrite(ctx, call);
}
break;
case FAIL:
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/CellBlockBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/CellBlockBuilder.java
index 9e9c0688ece..b2b3698aa2c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/CellBlockBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/CellBlockBuilder.java
@@ -228,6 +228,7 @@ class CellBlockBuilder {
}
/**
+ * Create a cell scanner.
* @param codec to use for cellblock
* @param cellBlock to encode
* @return CellScanner to work against the content of <code>cellBlock</code>
@@ -248,6 +249,7 @@ class CellBlockBuilder {
}
/**
+ * Create a cell scanner using an existing bytebuff.
* @param codec to use for cellblock
* @param cellBlock ByteBuffer containing the cells written by the Codec. The buffer should be
* position()'ed at the start of the cell block and limit()'ed at the end.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/ConnectionId.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/ConnectionId.java
index 6cb9cddd9fe..4de82e0c12a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/ConnectionId.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/ConnectionId.java
@@ -57,14 +57,18 @@ class ConnectionId {
}
@Override
+ @SuppressWarnings("ReferenceEquality")
public boolean equals(Object obj) {
- if (obj instanceof ConnectionId) {
- ConnectionId id = (ConnectionId) obj;
- return address.equals(id.address)
- && ((ticket != null && ticket.equals(id.ticket)) || (ticket == id.ticket))
- && Objects.equals(this.serviceName, id.serviceName);
+ if (obj == this) {
+ return true;
}
- return false;
+ if (!(obj instanceof ConnectionId)) {
+ return false;
+ }
+ ConnectionId id = (ConnectionId) obj;
+ return address.equals(id.address)
+ && ((ticket != null && ticket.equals(id.ticket)) || (ticket == id.ticket))
+ && Objects.equals(this.serviceName, id.serviceName);
}
@Override // simply use the default Object#hashcode() ?
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcController.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcController.java
index 01412631ef7..c60de7658f3 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcController.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcController.java
@@ -50,12 +50,14 @@ public interface HBaseRpcController extends RpcController, CellScannable {
void setCellScanner(CellScanner cellScanner);
/**
+ * Set the priority for this operation.
* @param priority Priority for this request; should fall roughly in the range
* {@link HConstants#NORMAL_QOS} to {@link HConstants#HIGH_QOS}
*/
void setPriority(int priority);
/**
+ * Set the priority for this operation.
* @param tn Set priority based off the table we are going against.
*/
void setPriority(final TableName tn);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcClient.java
index 7b698958ede..22123eb2a60 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcClient.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.client.MetricsConnection;
+import org.apache.hadoop.hbase.util.NettyFutureUtils;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.yetus.audience.InterfaceAudience;
@@ -78,7 +79,7 @@ public class NettyRpcClient extends AbstractRpcClient<NettyRpcConnection> {
@Override
protected void closeInternal() {
if (shutdownGroupWhenClose) {
- group.shutdownGracefully();
+ NettyFutureUtils.consume(group.shutdownGracefully());
}
}
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java
index d211b1b98e5..2e6bd1025af 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.ipc.HBaseRpcController.CancellationCallback;
import org.apache.hadoop.hbase.security.NettyHBaseRpcConnectionHeaderHandler;
import org.apache.hadoop.hbase.security.NettyHBaseSaslRpcClientHandler;
import org.apache.hadoop.hbase.security.SaslChallengeDecoder;
+import org.apache.hadoop.hbase.util.NettyFutureUtils;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.yetus.audience.InterfaceAudience;
@@ -129,7 +130,7 @@ class NettyRpcConnection extends RpcConnection {
private void shutdown0() {
assert eventLoop.inEventLoop();
if (channel != null) {
- channel.close();
+ NettyFutureUtils.consume(channel.close());
channel = null;
}
}
@@ -167,6 +168,7 @@ class NettyRpcConnection extends RpcConnection {
private boolean reloginInProgress;
+ @SuppressWarnings("FutureReturnValueIgnored")
private void scheduleRelogin(Throwable error) {
assert eventLoop.inEventLoop();
if (error instanceof FallbackDisallowedException) {
@@ -217,7 +219,7 @@ class NettyRpcConnection extends RpcConnection {
return;
}
ch.pipeline().addFirst(new SaslChallengeDecoder(), saslHandler);
- saslPromise.addListener(new FutureListener<Boolean>() {
+ NettyFutureUtils.consume(saslPromise.addListener(new FutureListener<Boolean>() {
@Override
public void operationComplete(Future<Boolean> future) throws Exception {
@@ -235,26 +237,27 @@ class NettyRpcConnection extends RpcConnection {
p.addFirst(
new ReadTimeoutHandler(RpcClient.DEFAULT_SOCKET_TIMEOUT_READ, TimeUnit.MILLISECONDS));
p.addLast(chHandler);
- connectionHeaderPromise.addListener(new FutureListener<Boolean>() {
- @Override
- public void operationComplete(Future<Boolean> future) throws Exception {
- if (future.isSuccess()) {
- ChannelPipeline p = ch.pipeline();
- p.remove(ReadTimeoutHandler.class);
- p.remove(NettyHBaseRpcConnectionHeaderHandler.class);
- // don't send connection header, NettyHbaseRpcConnectionHeaderHandler
- // sent it already
- established(ch);
- } else {
- final Throwable error = future.cause();
- scheduleRelogin(error);
- failInit(ch, toIOE(error));
+ NettyFutureUtils
+ .consume(connectionHeaderPromise.addListener(new FutureListener<Boolean>() {
+ @Override
+ public void operationComplete(Future<Boolean> future) throws Exception {
+ if (future.isSuccess()) {
+ ChannelPipeline p = ch.pipeline();
+ p.remove(ReadTimeoutHandler.class);
+ p.remove(NettyHBaseRpcConnectionHeaderHandler.class);
+ // don't send connection header, NettyHbaseRpcConnectionHeaderHandler
+ // sent it already
+ established(ch);
+ } else {
+ final Throwable error = future.cause();
+ scheduleRelogin(error);
+ failInit(ch, toIOE(error));
+ }
}
- }
- });
+ }));
} else {
// send the connection header to server
- ch.write(connectionHeaderWithLength.retainedDuplicate());
+ NettyFutureUtils.safeWrite(ch, connectionHeaderWithLength.retainedDuplicate());
established(ch);
}
} else {
@@ -263,7 +266,7 @@ class NettyRpcConnection extends RpcConnection {
failInit(ch, toIOE(error));
}
}
- });
+ }));
}
private void connect() throws UnknownHostException {
@@ -285,12 +288,12 @@ class NettyRpcConnection extends RpcConnection {
rpcClient.failedServers.addToFailedServers(remoteId.getAddress(), future.cause());
return;
}
- ch.writeAndFlush(connectionHeaderPreamble.retainedDuplicate());
+ NettyFutureUtils.safeWriteAndFlush(ch, connectionHeaderPreamble.retainedDuplicate());
if (useSasl) {
saslNegotiate(ch);
} else {
// send the connection header to server
- ch.write(connectionHeaderWithLength.retainedDuplicate());
+ NettyFutureUtils.safeWrite(ch, connectionHeaderWithLength.retainedDuplicate());
established(ch);
}
}
@@ -322,8 +325,7 @@ class NettyRpcConnection extends RpcConnection {
connect();
}
scheduleTimeoutTask(call);
- channel.writeAndFlush(call).addListener(new ChannelFutureListener() {
-
+ NettyFutureUtils.addListener(channel.writeAndFlush(call), new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
// Fail the call if we failed to write it out. This usually because the channel is
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
index fe32189f81b..700093a3027 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
@@ -31,7 +31,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.protobuf.Message;
-import org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder;
import org.apache.hbase.thirdparty.com.google.protobuf.TextFormat;
import org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf;
import org.apache.hbase.thirdparty.io.netty.buffer.ByteBufInputStream;
@@ -168,7 +167,7 @@ class NettyRpcDuplexHandler extends ChannelDuplexHandler {
}
Message value;
if (call.responseDefaultType != null) {
- Builder builder = call.responseDefaultType.newBuilderForType();
+ Message.Builder builder = call.responseDefaultType.newBuilderForType();
builder.mergeDelimitedFrom(in);
value = builder.build();
} else {
@@ -202,7 +201,7 @@ class NettyRpcDuplexHandler extends ChannelDuplexHandler {
}
}
- private void cleanupCalls(ChannelHandlerContext ctx, IOException error) {
+ private void cleanupCalls(IOException error) {
for (Call call : id2Call.values()) {
call.setException(error);
}
@@ -212,7 +211,7 @@ class NettyRpcDuplexHandler extends ChannelDuplexHandler {
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
if (!id2Call.isEmpty()) {
- cleanupCalls(ctx, new ConnectionClosedException("Connection closed"));
+ cleanupCalls(new ConnectionClosedException("Connection closed"));
}
conn.shutdown();
ctx.fireChannelInactive();
@@ -221,7 +220,7 @@ class NettyRpcDuplexHandler extends ChannelDuplexHandler {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
if (!id2Call.isEmpty()) {
- cleanupCalls(ctx, IPCUtil.toIOE(cause));
+ cleanupCalls(IPCUtil.toIOE(cause));
}
conn.shutdown();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
index 6ecff49e52b..045216e8881 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
@@ -90,8 +90,8 @@ public interface RpcClient extends Closeable {
void close();
/**
- * @return true when this client uses a {@link org.apache.hadoop.hbase.codec.Codec} and so
- * supports cell blocks.
+ * Return true when this client uses a {@link org.apache.hadoop.hbase.codec.Codec} and so supports
+ * cell blocks.
*/
boolean hasCellBlockSupport();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/master/RegionState.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/master/RegionState.java
index 2b0f2f4509e..4fc6cac029f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/master/RegionState.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/master/RegionState.java
@@ -384,6 +384,7 @@ public class RegionState {
/**
* A slower (but more easy-to-read) stringification
*/
+ @SuppressWarnings("JavaUtilDate")
public String toDescriptiveString() {
long relTime = EnvironmentEdgeManager.currentTime() - stamp;
return hri.getRegionNameAsString() + " state=" + state + ", ts=" + new Date(stamp) + " ("
@@ -417,12 +418,13 @@ public class RegionState {
*/
@Override
public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof RegionState)) {
return false;
}
RegionState tmp = (RegionState) obj;
-
return RegionInfo.COMPARATOR.compare(tmp.hri, hri) == 0 && tmp.state == state
&& ((serverName != null && serverName.equals(tmp.serverName))
|| (tmp.serverName == null && serverName == null));
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java
index 15a196cbe5b..4a285ba40be 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufMagic.java
@@ -35,8 +35,7 @@ public class ProtobufMagic {
public static final byte[] PB_MAGIC = new byte[] { 'P', 'B', 'U', 'F' };
/**
- * @param bytes Bytes to check.
- * @return True if passed <code>bytes</code> has {@link #PB_MAGIC} for a prefix.
+ * Returns True if passed <code>bytes</code> has {@link #PB_MAGIC} for a prefix.
*/
public static boolean isPBMagicPrefix(final byte[] bytes) {
if (bytes == null) return false;
@@ -66,12 +65,7 @@ public class ProtobufMagic {
return length1 - length2;
}
- /**
- * @param bytes Bytes to check.
- * @param offset offset to start at
- * @param len length to use
- * @return True if passed <code>bytes</code> has {@link #PB_MAGIC} for a prefix.
- */
+ /** Returns True if passed <code>bytes</code> has {@link #PB_MAGIC} for a prefix. */
public static boolean isPBMagicPrefix(final byte[] bytes, int offset, int len) {
if (bytes == null || len < PB_MAGIC.length) return false;
return compareTo(PB_MAGIC, 0, PB_MAGIC.length, bytes, offset, PB_MAGIC.length) == 0;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
index 76ce56318ed..f8820306699 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
@@ -43,7 +43,6 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.Cell.Type;
import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.CellUtil;
@@ -194,6 +193,7 @@ public final class ProtobufUtil {
}
/**
+ * Check for {@link ProtobufMagic#PB_MAGIC}
* @param bytes Bytes to check.
* @return True if passed <code>bytes</code> has {@link ProtobufMagic#PB_MAGIC} for a prefix.
*/
@@ -202,6 +202,7 @@ public final class ProtobufUtil {
}
/**
+ * Check for {@link ProtobufMagic#PB_MAGIC}
* @param bytes Bytes to check.
* @param offset offset to start at
* @param len length to use
@@ -212,6 +213,7 @@ public final class ProtobufUtil {
}
/**
+ * Check for {@link ProtobufMagic#PB_MAGIC}
* @param bytes bytes to check
* @throws DeserializationException if we are missing the pb magic prefix
*/
@@ -523,7 +525,7 @@ public final class ProtobufUtil {
} else {
put.add(cellBuilder.clear().setRow(put.getRow()).setFamily(family)
.setQualifier(qv.hasQualifier() ? qv.getQualifier().toByteArray() : null)
- .setTimestamp(ts).setType(Type.Put)
+ .setTimestamp(ts).setType(Cell.Type.Put)
.setValue(qv.hasValue() ? qv.getValue().toByteArray() : null).build());
}
}
@@ -677,9 +679,8 @@ public final class ProtobufUtil {
}
/**
- * Convert a protocol buffer Mutate to an Append n * @param proto the protocol buffer Mutate to
- * convert
- * @return the converted client Append n
+ * Convert a protocol buffer Mutate to an Append
+ * @return the converted client Append
*/
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
@@ -696,8 +697,7 @@ public final class ProtobufUtil {
/**
* Convert a protocol buffer Mutate to an Increment
- * @param proto the protocol buffer Mutate to convert
- * @return the converted client Increment n
+ * @return the converted client Increment
*/
public static Increment toIncrement(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java
index 728959e0a0c..1dd5bf275bb 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java
@@ -19,8 +19,8 @@ package org.apache.hadoop.hbase.quotas;
import java.io.Closeable;
import java.io.IOException;
+import java.util.ArrayDeque;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.Objects;
import java.util.Queue;
import org.apache.hadoop.conf.Configuration;
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
public class QuotaRetriever implements Closeable, Iterable<QuotaSettings> {
private static final Logger LOG = LoggerFactory.getLogger(QuotaRetriever.class);
- private final Queue<QuotaSettings> cache = new LinkedList<>();
+ private final Queue<QuotaSettings> cache = new ArrayDeque<>();
private ResultScanner scanner;
/**
* Connection to use. Could pass one in and have this class use it but this class wants to be
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/SpaceLimitSettings.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/SpaceLimitSettings.java
index 878cbe871e5..4a230338598 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/SpaceLimitSettings.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/SpaceLimitSettings.java
@@ -23,7 +23,7 @@ import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest.Builder;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest;
import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceLimitRequest;
import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota;
@@ -113,7 +113,7 @@ class SpaceLimitSettings extends QuotaSettings {
}
@Override
- protected void setupSetQuotaRequest(Builder builder) {
+ protected void setupSetQuotaRequest(SetQuotaRequest.Builder builder) {
// TableName/Namespace are serialized in QuotaSettings
builder.setSpaceLimit(proto);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSink.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSink.java
index 9da498c0452..f954cdc9d9b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSink.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSink.java
@@ -42,6 +42,7 @@ public class ReplicationLoadSink {
}
/**
+ * Get the timestamp of the last applied operation.
* @deprecated Since hbase-2.0.0. Will be removed in 3.0.0.
* @see #getTimestampsOfLastAppliedOp()
*/
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSource.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSource.java
index 15cbda439a5..49c75240778 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSource.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSource.java
@@ -68,6 +68,7 @@ public final class ReplicationLoadSource {
}
/**
+ * Get the timestamp of the last shipped operation.
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
* @see #getTimestampOfLastShippedOp()
*/
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/NettyHBaseRpcConnectionHeaderHandler.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/NettyHBaseRpcConnectionHeaderHandler.java
index 20197912dcb..cb680b51724 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/NettyHBaseRpcConnectionHeaderHandler.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/NettyHBaseRpcConnectionHeaderHandler.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.security;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.io.crypto.aes.CryptoAES;
+import org.apache.hadoop.hbase.util.NettyFutureUtils;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf;
@@ -66,15 +67,14 @@ public class NettyHBaseRpcConnectionHeaderHandler extends SimpleChannelInboundHa
// replace the Sasl handler with Crypto AES handler
setupCryptoAESHandler(ctx.pipeline(), cryptoAES);
}
-
- saslPromise.setSuccess(true);
+ NettyFutureUtils.consume(saslPromise.setSuccess(true));
}
@Override
public void handlerAdded(ChannelHandlerContext ctx) {
try {
// send the connection header to server first
- ctx.writeAndFlush(connectionHeaderWithLength.retainedDuplicate());
+ NettyFutureUtils.safeWriteAndFlush(ctx, connectionHeaderWithLength.retainedDuplicate());
} catch (Exception e) {
// the exception thrown by handlerAdded will not be passed to the exceptionCaught below
// because netty will remove a handler if handlerAdded throws an exception.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java
index c2dc1042c91..dfb0a49db4a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslUtil.java
@@ -29,6 +29,8 @@ import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.hbase.thirdparty.com.google.common.base.Splitter;
+
@InterfaceAudience.Private
public class SaslUtil {
private static final Logger LOG = LoggerFactory.getLogger(SaslUtil.class);
@@ -62,7 +64,7 @@ public class SaslUtil {
/** Splitting fully qualified Kerberos name into parts */
public static String[] splitKerberosName(String fullName) {
- return fullName.split("[/@]");
+ return Splitter.onPattern("[/@]").splitToStream(fullName).toArray(String[]::new);
}
public static String encodeIdentifier(byte[] identifier) {
@@ -93,6 +95,7 @@ public class SaslUtil {
}
/**
+ * Initialize SASL properties for a given RPC protection level.
* @param rpcProtection Value of 'hbase.rpc.protection' configuration.
* @return Map with values for SASL properties.
*/
@@ -101,10 +104,9 @@ public class SaslUtil {
if (rpcProtection.isEmpty()) {
saslQop = QualityOfProtection.AUTHENTICATION.getSaslQop();
} else {
- String[] qops = rpcProtection.split(",");
StringBuilder saslQopBuilder = new StringBuilder();
- for (int i = 0; i < qops.length; ++i) {
- QualityOfProtection qop = getQop(qops[i]);
+ for (String s : Splitter.on(',').split(rpcProtection)) {
+ QualityOfProtection qop = getQop(s);
saslQopBuilder.append(",").append(qop.getSaslQop());
}
saslQop = saslQopBuilder.substring(1); // remove first ','
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlClient.java
index c6c0c2ecde5..e30041d46c4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlClient.java
@@ -29,12 +29,8 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.security.SecurityCapability;
-import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
-import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos;
-import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService.BlockingInterface;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.yetus.audience.InterfaceAudience;
@@ -66,17 +62,17 @@ public class AccessControlClient {
.contains(SecurityCapability.CELL_AUTHORIZATION);
}
- private static BlockingInterface getAccessControlServiceStub(Table ht) throws IOException {
- CoprocessorRpcChannel service = ht.coprocessorService(HConstants.EMPTY_START_ROW);
- BlockingInterface protocol = AccessControlProtos.AccessControlService.newBlockingStub(service);
- return protocol;
- }
-
/**
* Grants permission on the specified table for the specified user
- * @param connection The Connection instance to use nnnn * @param mergeExistingPermissions If set
- * to false, later granted permissions will override previous granted
- * permissions. otherwise, it'll merge with previous granted permissions. nn
+ * @param connection The Connection instance to use
+ * @param tableName the table name
+ * @param userName the user name
+ * @param family the column family
+ * @param qual the column qualifier
+ * @param mergeExistingPermissions If set to false, later granted permissions will override
+ * previous granted permissions. otherwise, it'll merge with
+ * previous granted permissions.
+ * @param actions the actions
*/
private static void grant(Connection connection, final TableName tableName, final String userName,
final byte[] family, final byte[] qual, boolean mergeExistingPermissions,
@@ -89,7 +85,12 @@ public class AccessControlClient {
/**
* Grants permission on the specified table for the specified user. If permissions for a specified
* user exists, later granted permissions will override previous granted permissions.
- * @param connection The Connection instance to use nnnnnn
+ * @param connection The Connection instance to use
+ * @param tableName the table name
+ * @param userName the user name
+ * @param family the column family
+ * @param qual the column qualifier
+ * @param actions the actions
*/
public static void grant(Connection connection, final TableName tableName, final String userName,
final byte[] family, final byte[] qual, final Permission.Action... actions) throws Throwable {
@@ -97,9 +98,14 @@ public class AccessControlClient {
}
/**
- * Grants permission on the specified namespace for the specified user. nnn * @param
- * mergeExistingPermissions If set to false, later granted permissions will override previous
- * granted permissions. otherwise, it'll merge with previous granted permissions. nn
+ * Grants permission on the specified namespace for the specified user.
+ * @param connection The Connection instance to use
+ * @param namespace the namespace
+ * @param userName the user name
+ * @param mergeExistingPermissions If set to false, later granted permissions will override
+ * previous granted permissions. otherwise, it'll merge with
+ * previous granted permissions.
+ * @param actions the actions
*/
private static void grant(Connection connection, final String namespace, final String userName,
boolean mergeExistingPermissions, final Permission.Action... actions) throws Throwable {
@@ -112,7 +118,10 @@ public class AccessControlClient {
* Grants permission on the specified namespace for the specified user. If permissions on the
* specified namespace exists, later granted permissions will override previous granted
* permissions.
- * @param connection The Connection instance to use nnnn
+ * @param connection The Connection instance to use
+ * @param namespace the namespace
+ * @param userName the user name
+ * @param actions the actions
*/
public static void grant(Connection connection, final String namespace, final String userName,
final Permission.Action... actions) throws Throwable {
@@ -120,9 +129,13 @@ public class AccessControlClient {
}
/**
- * Grant global permissions for the specified user. nn * @param mergeExistingPermissions If set to
- * false, later granted permissions will override previous granted permissions. otherwise, it'll
- * merge with previous granted permissions. nn
+ * Grant global permissions for the specified user.
+ * @param connection The Connection instance to use
+ * @param userName the user name
+ * @param mergeExistingPermissions If set to false, later granted permissions will override
+ * previous granted permissions. otherwise, it'll merge with
+ * previous granted permissions.
+ * @param actions the actions
*/
private static void grant(Connection connection, final String userName,
boolean mergeExistingPermissions, final Permission.Action... actions) throws Throwable {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java
index 6496aaa0bb8..1fa1bdfd21c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java
@@ -40,9 +40,6 @@ import org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap;
import org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap;
import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
-/**
- * @since 2.0.0
- */
@InterfaceAudience.Private
public class AccessControlUtil {
private AccessControlUtil() {
@@ -223,13 +220,12 @@ public class AccessControlUtil {
*/
public static TablePermission toTablePermission(AccessControlProtos.TablePermission proto) {
Permission.Action[] actions = toPermissionActions(proto.getActionList());
- TableName table = null;
- byte[] qualifier = null;
- byte[] family = null;
if (!proto.hasTableName()) {
throw new IllegalStateException("TableName cannot be empty");
}
- table = ProtobufUtil.toTableName(proto.getTableName());
+ TableName table = ProtobufUtil.toTableName(proto.getTableName());
+ byte[] family = null;
+ byte[] qualifier = null;
if (proto.hasFamily()) {
family = proto.getFamily().toByteArray();
}
@@ -262,13 +258,12 @@ public class AccessControlUtil {
if (proto.getType() == AccessControlProtos.Permission.Type.Table) {
AccessControlProtos.TablePermission perm = proto.getTablePermission();
Permission.Action[] actions = toPermissionActions(perm.getActionList());
- byte[] qualifier = null;
- byte[] family = null;
- TableName table = null;
if (!perm.hasTableName()) {
throw new IllegalStateException("TableName cannot be empty");
}
- table = ProtobufUtil.toTableName(perm.getTableName());
+ TableName table = ProtobufUtil.toTableName(perm.getTableName());
+ byte[] family = null;
+ byte[] qualifier = null;
if (perm.hasFamily()) {
family = perm.getFamily().toByteArray();
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/ShadedAccessControlUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/ShadedAccessControlUtil.java
index b6df2c94a04..cf7c797c98a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/ShadedAccessControlUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/ShadedAccessControlUtil.java
@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.security.access.Permission.Action;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap;
@@ -32,7 +31,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.GetUserPermissionsResponse;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.GrantRequest;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.HasUserPermissionsRequest;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission.Type;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.RevokeRequest;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
@@ -122,12 +120,12 @@ public class ShadedAccessControlUtil {
if (proto.getType() == AccessControlProtos.Permission.Type.Global) {
AccessControlProtos.GlobalPermission perm = proto.getGlobalPermission();
- Action[] actions = toPermissionActions(perm.getActionList());
+ Permission.Action[] actions = toPermissionActions(perm.getActionList());
return Permission.newBuilder().withActions(actions).build();
}
if (proto.getType() == AccessControlProtos.Permission.Type.Namespace) {
AccessControlProtos.NamespacePermission perm = proto.getNamespacePermission();
- Action[] actions = toPermissionActions(perm.getActionList());
+ Permission.Action[] actions = toPermissionActions(perm.getActionList());
if (!proto.hasNamespacePermission()) {
throw new IllegalStateException("Namespace must not be empty in NamespacePermission");
@@ -137,7 +135,7 @@ public class ShadedAccessControlUtil {
}
if (proto.getType() == AccessControlProtos.Permission.Type.Table) {
AccessControlProtos.TablePermission perm = proto.getTablePermission();
- Action[] actions = toPermissionActions(perm.getActionList());
+ Permission.Action[] actions = toPermissionActions(perm.getActionList());
byte[] qualifier = null;
byte[] family = null;
@@ -292,14 +290,14 @@ public class ShadedAccessControlUtil {
}
if (request.getNamespace() != null && !request.getNamespace().isEmpty()) {
builder.setNamespaceName(ByteString.copyFromUtf8(request.getNamespace()));
- builder.setType(Type.Namespace);
+ builder.setType(AccessControlProtos.Permission.Type.Namespace);
}
if (request.getTableName() != null) {
builder.setTableName(toProtoTableName(request.getTableName()));
- builder.setType(Type.Table);
+ builder.setType(AccessControlProtos.Permission.Type.Table);
}
if (!builder.hasType()) {
- builder.setType(Type.Global);
+ builder.setType(AccessControlProtos.Permission.Type.Global);
}
if (request.getFamily() != null && request.getFamily().length > 0) {
builder.setColumnFamily(ByteString.copyFrom(request.getFamily()));
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/TablePermission.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/TablePermission.java
index e0a12c7d431..65ebbef7da0 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/TablePermission.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/TablePermission.java
@@ -141,11 +141,11 @@ public class TablePermission extends Permission {
return false;
}
- if (family != null && !(CellUtil.matchingFamily(kv, family))) {
+ if (family != null && !CellUtil.matchingFamily(kv, family)) {
return false;
}
- if (qualifier != null && !(CellUtil.matchingQualifier(kv, qualifier))) {
+ if (qualifier != null && !CellUtil.matchingQualifier(kv, qualifier)) {
return false;
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
index cca5e8362ef..0c9dc35d75d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
@@ -153,7 +153,7 @@ public class VisibilityClient {
}
/**
- * nn * @return labels, the given user is globally authorized for. n * @deprecated Use
+ * Returns labels, the given user is globally authorized for. n * @deprecated Use
* {@link #getAuths(Connection,String)} instead.
*/
@Deprecated
@@ -164,8 +164,10 @@ public class VisibilityClient {
}
/**
- * @param connection the Connection instance to use. n * @return labels, the given user is
- * globally authorized for. n
+ * Get the authorization for a given user
+ * @param connection the Connection instance to use
+ * @param user the user
+ * @return labels the given user is globally authorized for
*/
public static GetAuthsResponse getAuths(Connection connection, final String user)
throws Throwable {
@@ -196,10 +198,11 @@ public class VisibilityClient {
}
/**
- * Retrieve the list of visibility labels defined in the system. n * @param regex The regular
- * expression to filter which labels are returned.
- * @return labels The list of visibility labels defined in the system. n * @deprecated Use
- * {@link #listLabels(Connection,String)} instead.
+ * Retrieve the list of visibility labels defined in the system.
+ * @param conf the configuration to use
+ * @param regex The regular expression to filter which labels are returned.
+ * @return labels The list of visibility labels defined in the system.
+ * @deprecated Use {@link #listLabels(Connection,String)} instead.
*/
@Deprecated
public static ListLabelsResponse listLabels(Configuration conf, final String regex)
@@ -285,7 +288,7 @@ public class VisibilityClient {
setAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user)));
for (String auth : auths) {
if (auth.length() > 0) {
- setAuthReqBuilder.addAuth((ByteString.copyFromUtf8(auth)));
+ setAuthReqBuilder.addAuth(ByteString.copyFromUtf8(auth));
}
}
if (setOrClear) {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
index cb063938848..1d296229fcf 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
@@ -49,7 +49,6 @@ import org.apache.hadoop.hbase.ByteBufferExtendedCell;
import org.apache.hadoop.hbase.CacheEvictionStats;
import org.apache.hadoop.hbase.CacheEvictionStatsBuilder;
import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.Cell.Type;
import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.CellUtil;
@@ -304,25 +303,18 @@ public final class ProtobufUtil {
return Bytes.add(PB_MAGIC, bytes);
}
- /**
- * @param bytes Bytes to check.
- * @return True if passed <code>bytes</code> has {@link ProtobufMagic#PB_MAGIC} for a prefix.
- */
+ /** Returns True if passed <code>bytes</code> has {@link ProtobufMagic#PB_MAGIC} for a prefix. */
public static boolean isPBMagicPrefix(final byte[] bytes) {
return ProtobufMagic.isPBMagicPrefix(bytes);
}
- /**
- * @param bytes Bytes to check.
- * @param offset offset to start at
- * @param len length to use
- * @return True if passed <code>bytes</code> has {@link ProtobufMagic#PB_MAGIC} for a prefix.
- */
+ /** Returns True if passed <code>bytes</code> has {@link ProtobufMagic#PB_MAGIC} for a prefix. */
public static boolean isPBMagicPrefix(final byte[] bytes, int offset, int len) {
return ProtobufMagic.isPBMagicPrefix(bytes, offset, len);
}
/**
+ * Expect the {@link ProtobufMagic#PB_MAGIC} or throw an exception.
* @param bytes bytes to check
* @throws DeserializationException if we are missing the pb magic prefix
*/
@@ -683,7 +675,7 @@ public final class ProtobufUtil {
} else {
put.add(cellBuilder.clear().setRow(put.getRow()).setFamily(family)
.setQualifier(qv.hasQualifier() ? qv.getQualifier().toByteArray() : null)
- .setTimestamp(ts).setType(Type.Put)
+ .setTimestamp(ts).setType(Cell.Type.Put)
.setValue(qv.hasValue() ? qv.getValue().toByteArray() : null).build());
}
}
@@ -840,9 +832,9 @@ public final class ProtobufUtil {
}
/**
- * Convert a protocol buffer Mutate to an Append n * @param proto the protocol buffer Mutate to
- * convert
- * @return the converted client Append n
+ * Convert a protocol buffer Mutate to an Append
+ * @param proto the protocol buffer Mutate to convert
+ * @return the converted client Append
*/
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
@@ -860,7 +852,7 @@ public final class ProtobufUtil {
/**
* Convert a protocol buffer Mutate to an Increment
* @param proto the protocol buffer Mutate to convert
- * @return the converted client Increment n
+ * @return the converted client Increment
*/
public static Increment toIncrement(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
@@ -1803,9 +1795,6 @@ public final class ProtobufUtil {
return rl.getReadRequestsCount() + rl.getWriteRequestsCount();
}
- /**
- * @param m Message to get delimited pb serialization of (with pb magic prefix)
- */
public static byte[] toDelimitedByteArray(final Message m) throws IOException {
// Allocate arbitrary big size so we avoid resizing.
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/RequestConverter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/RequestConverter.java
index 0ca16009d6c..7ef234f6b7f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/RequestConverter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/RequestConverter.java
@@ -900,6 +900,7 @@ public final class RequestConverter {
}
/**
+ * Create a protocol buffer GetRegionInfoRequest,
* @param regionName the name of the region to get info
* @param includeCompactionState indicate if the compaction state is requested
* @param includeBestSplitRow indicate if the bestSplitRow is requested
@@ -1121,7 +1122,7 @@ public final class RequestConverter {
public static ModifyColumnRequest buildModifyColumnRequest(final TableName tableName,
final ColumnFamilyDescriptor column, final long nonceGroup, final long nonce) {
ModifyColumnRequest.Builder builder = ModifyColumnRequest.newBuilder();
- builder.setTableName(ProtobufUtil.toProtoTableName((tableName)));
+ builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
builder.setColumnFamilies(ProtobufUtil.toColumnFamilySchema(column));
builder.setNonceGroup(nonceGroup);
builder.setNonce(nonce);
@@ -1133,7 +1134,7 @@ public final class RequestConverter {
final long nonce) {
ModifyColumnStoreFileTrackerRequest.Builder builder =
ModifyColumnStoreFileTrackerRequest.newBuilder();
- builder.setTableName(ProtobufUtil.toProtoTableName((tableName)));
+ builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
builder.setFamily(ByteString.copyFrom(family));
builder.setDstSft(dstSFT);
builder.setNonceGroup(nonceGroup);
@@ -1255,7 +1256,7 @@ public final class RequestConverter {
public static DisableTableRequest buildDisableTableRequest(final TableName tableName,
final long nonceGroup, final long nonce) {
DisableTableRequest.Builder builder = DisableTableRequest.newBuilder();
- builder.setTableName(ProtobufUtil.toProtoTableName((tableName)));
+ builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
builder.setNonceGroup(nonceGroup);
builder.setNonce(nonce);
return builder.build();
@@ -1284,7 +1285,7 @@ public final class RequestConverter {
public static ModifyTableRequest buildModifyTableRequest(final TableName tableName,
final TableDescriptor tableDesc, final long nonceGroup, final long nonce) {
ModifyTableRequest.Builder builder = ModifyTableRequest.newBuilder();
- builder.setTableName(ProtobufUtil.toProtoTableName((tableName)));
+ builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
builder.setTableSchema(ProtobufUtil.toTableSchema(tableDesc));
builder.setNonceGroup(nonceGroup);
builder.setNonce(nonce);
@@ -1295,7 +1296,7 @@ public final class RequestConverter {
final TableName tableName, final String dstSFT, final long nonceGroup, final long nonce) {
ModifyTableStoreFileTrackerRequest.Builder builder =
ModifyTableStoreFileTrackerRequest.newBuilder();
- builder.setTableName(ProtobufUtil.toProtoTableName((tableName)));
+ builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
builder.setDstSft(dstSFT);
builder.setNonceGroup(nonceGroup);
builder.setNonce(nonce);
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/util/Writables.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/util/Writables.java
index 7ebbbf44ceb..091515c325e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/util/Writables.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/util/Writables.java
@@ -34,6 +34,7 @@ import org.apache.yetus.audience.InterfaceAudience;
@InterfaceAudience.Private
public class Writables {
/**
+ * Get the Writable's contents as a byte array
* @param w writable
* @return The bytes of <code>w</code> gotten by running its
* {@link Writable#write(java.io.DataOutput)} method.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ReadOnlyZKClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ReadOnlyZKClient.java
index 96170736208..979094fda80 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ReadOnlyZKClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ReadOnlyZKClient.java
@@ -183,6 +183,8 @@ public final class ReadOnlyZKClient implements Closeable {
try {
zk.close();
} catch (InterruptedException e) {
+ // Restore interrupt status
+ Thread.currentThread().interrupt();
}
}
if (ZKTask.this.delay(retryIntervalMs, maxRetries)) {
@@ -303,6 +305,8 @@ public final class ReadOnlyZKClient implements Closeable {
try {
zookeeper.close();
} catch (InterruptedException e) {
+ // Restore interrupt status
+ Thread.currentThread().interrupt();
}
zookeeper = null;
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMetadata.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMetadata.java
index f0fae958a66..b795ad45aa1 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMetadata.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMetadata.java
@@ -54,7 +54,7 @@ public class ZKMetadata {
pos = Bytes.putInt(newData, pos, idLength);
pos = Bytes.putBytes(newData, pos, id, 0, id.length);
pos = Bytes.putBytes(newData, pos, salt, 0, salt.length);
- pos = Bytes.putBytes(newData, pos, data, 0, data.length);
+ Bytes.putBytes(newData, pos, data, 0, data.length);
return newData;
}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java
index 2bfaa2de788..cdf043dad76 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java
@@ -86,11 +86,7 @@ public class TestHTableDescriptor {
// Try more spec.
String spec = "hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2";
- try {
- htd.addCoprocessorWithSpec(spec);
- } catch (IllegalArgumentException iae) {
- fail();
- }
+ htd.addCoprocessorWithSpec(spec);
// Try double add of same coprocessor
try {
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java
index 89634924e57..de6d6012322 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java
@@ -28,7 +28,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
@@ -428,6 +427,8 @@ public class TestAsyncProcess {
try {
Thread.sleep(sleep);
} catch (InterruptedException e) {
+ // Restore interrupt status
+ Thread.currentThread().interrupt();
}
}
return mr;
@@ -525,15 +526,14 @@ public class TestAsyncProcess {
@Test
public void testListRowAccess() {
int count = 10;
- List<String> values = new LinkedList<>();
+ List<String> values = new ArrayList<>();
for (int i = 0; i != count; ++i) {
values.add(String.valueOf(i));
}
- ListRowAccess<String> taker = new ListRowAccess(values);
+ ListRowAccess<String> taker = new ListRowAccess<>(values);
assertEquals(count, taker.size());
- int restoreCount = 0;
int takeCount = 0;
Iterator<String> it = taker.iterator();
while (it.hasNext()) {
@@ -1330,7 +1330,7 @@ public class TestAsyncProcess {
MyAsyncProcess ap = new MyAsyncProcess(conn, copyConf);
try (HTable ht = (HTable) conn.getTable(DUMMY_TABLE)) {
ht.multiAp = ap;
- List<Get> gets = new LinkedList<>();
+ List<Get> gets = new ArrayList<>();
gets.add(new Get(DUMMY_BYTES_1));
gets.add(new Get(DUMMY_BYTES_2));
try {
@@ -1349,7 +1349,7 @@ public class TestAsyncProcess {
assertEquals(readTimeout, ap.previousTimeout);
ap.previousTimeout = -1;
- List<Delete> deletes = new LinkedList<>();
+ List<Delete> deletes = new ArrayList<>();
deletes.add(new Delete(DUMMY_BYTES_1));
deletes.add(new Delete(DUMMY_BYTES_2));
ht.delete(deletes);
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableRpcPriority.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableRpcPriority.java
index 7d6ef3f0c4e..d1a5dcc8383 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableRpcPriority.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableRpcPriority.java
@@ -45,7 +45,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.Cell.Type;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -135,10 +134,11 @@ public class TestAsyncTableRpcPriority {
case INCREMENT:
ColumnValue value = req.getColumnValue(0);
QualifierValue qvalue = value.getQualifierValue(0);
- Cell cell = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setType(Type.Put)
- .setRow(req.getRow().toByteArray()).setFamily(value.getFamily().toByteArray())
- .setQualifier(qvalue.getQualifier().toByteArray())
- .setValue(qvalue.getValue().toByteArray()).build();
+ Cell cell =
+ CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setType(Cell.Type.Put)
+ .setRow(req.getRow().toByteArray()).setFamily(value.getFamily().toByteArray())
+ .setQualifier(qvalue.getQualifier().toByteArray())
+ .setValue(qvalue.getValue().toByteArray()).build();
resp = MutateResponse.newBuilder()
.setResult(ProtobufUtil.toResult(Result.create(Arrays.asList(cell)))).build();
break;
@@ -496,8 +496,8 @@ public class TestAsyncTableRpcPriority {
assertFalse("close scanner should not come in with scan priority " + scanPriority,
req.hasCloseScanner() && req.getCloseScanner());
- Cell cell = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setType(Type.Put)
- .setRow(Bytes.toBytes(scanNextCalled.incrementAndGet()))
+ Cell cell = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
+ .setType(Cell.Type.Put).setRow(Bytes.toBytes(scanNextCalled.incrementAndGet()))
.setFamily(Bytes.toBytes("cf")).setQualifier(Bytes.toBytes("cq"))
.setValue(Bytes.toBytes("v")).build();
Result result = Result.create(Arrays.asList(cell));
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java
index a5ea94e7cae..3a8f1c55380 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java
@@ -389,8 +389,8 @@ public class TestAsyncTableTracing {
@Test
public void testCheckAndMutateBuilderThenMutations() throws IOException {
RowMutations mutations = new RowMutations(Bytes.toBytes(0))
- .add((Mutation) (new Put(Bytes.toBytes(0)).addColumn(Bytes.toBytes("f"), Bytes.toBytes("cq"),
- Bytes.toBytes("v"))))
+ .add((Mutation) new Put(Bytes.toBytes(0)).addColumn(Bytes.toBytes("f"), Bytes.toBytes("cq"),
+ Bytes.toBytes("v")))
.add((Mutation) new Delete(Bytes.toBytes(0)));
testCheckAndMutateBuilder(mutations);
}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java
index e4ce5ca4a3a..77a3b838a9b 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientNoCluster.java
@@ -32,7 +32,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.lang3.NotImplementedException;
@@ -72,7 +71,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.base.Stopwatch;
-import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.hbase.thirdparty.com.google.protobuf.ByteString;
import org.apache.hbase.thirdparty.com.google.protobuf.RpcController;
import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException;
@@ -177,9 +175,6 @@ public class TestClientNoCluster extends Configured implements Tool {
// I expect this exception.
LOG.info("Got expected exception", e);
t = e;
- } catch (RetriesExhaustedException e) {
- // This is the old, unwanted behavior. If we get here FAIL!!!
- fail();
} finally {
table.close();
}
@@ -242,9 +237,6 @@ public class TestClientNoCluster extends Configured implements Tool {
// I expect this exception.
LOG.info("Got expected exception", e);
t = e;
- } catch (RetriesExhaustedException e) {
- // This is the old, unwanted behavior. If we get here FAIL!!!
- fail();
} finally {
table.close();
connection.close();
@@ -830,14 +822,8 @@ public class TestClientNoCluster extends Configured implements Tool {
getConf().setInt("hbase.test.multi.too.many", 10);
final int clients = 2;
- // Have them all share the same connection so they all share the same instance of
- // ManyServersManyRegionsConnection so I can keep an eye on how many requests by server.
- final ExecutorService pool =
- Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("p-pool-%d")
- .setUncaughtExceptionHandler(Threads.LOGGING_EXCEPTION_HANDLER).build());
- // Executors.newFixedThreadPool(servers * 10, Threads.getNamedThreadFactory("p"));
// Share a connection so I can keep counts in the 'server' on concurrency.
- final Connection sharedConnection = ConnectionFactory.createConnection(getConf()/* , pool */);
+ final Connection sharedConnection = ConnectionFactory.createConnection(getConf());
try {
Thread[] ts = new Thread[clients];
for (int j = 0; j < ts.length; j++) {
@@ -850,7 +836,7 @@ public class TestClientNoCluster extends Configured implements Tool {
try {
cycle(id, c, sharedConnection);
} catch (IOException e) {
- e.printStackTrace();
+ LOG.info("Exception in cycle " + id, e);
}
}
};
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientScanner.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientScanner.java
index 38776e337fe..ffc9caa27d7 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientScanner.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientScanner.java
@@ -39,7 +39,6 @@ import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.RegionLocations;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.ScannerCallable.MoreResults;
@@ -139,8 +138,8 @@ public class TestClientScanner {
@SuppressWarnings("unchecked")
public void testNoResultsHint() throws IOException {
final Result[] results = new Result[1];
- KeyValue kv1 =
- new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1, Type.Maximum);
+ KeyValue kv1 = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1,
+ KeyValue.Type.Maximum);
results[0] = Result.create(new Cell[] { kv1 });
RpcRetryingCaller<Result[]> caller = Mockito.mock(RpcRetryingCaller.class);
@@ -200,8 +199,8 @@ public class TestClientScanner {
@SuppressWarnings("unchecked")
public void testSizeLimit() throws IOException {
final Result[] results = new Result[1];
- KeyValue kv1 =
- new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1, Type.Maximum);
+ KeyValue kv1 = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1,
+ KeyValue.Type.Maximum);
results[0] = Result.create(new Cell[] { kv1 });
RpcRetryingCaller<Result[]> caller = Mockito.mock(RpcRetryingCaller.class);
@@ -259,11 +258,11 @@ public class TestClientScanner {
@SuppressWarnings("unchecked")
public void testCacheLimit() throws IOException {
KeyValue kv1 = new KeyValue(Bytes.toBytes("row1"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1,
- Type.Maximum);
+ KeyValue.Type.Maximum);
KeyValue kv2 = new KeyValue(Bytes.toBytes("row2"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1,
- Type.Maximum);
+ KeyValue.Type.Maximum);
KeyValue kv3 = new KeyValue(Bytes.toBytes("row3"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1,
- Type.Maximum);
+ KeyValue.Type.Maximum);
final Result[] results = new Result[] { Result.create(new Cell[] { kv1 }),
Result.create(new Cell[] { kv2 }), Result.create(new Cell[] { kv3 }) };
@@ -336,8 +335,8 @@ public class TestClientScanner {
@SuppressWarnings("unchecked")
public void testNoMoreResults() throws IOException {
final Result[] results = new Result[1];
- KeyValue kv1 =
- new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1, Type.Maximum);
+ KeyValue kv1 = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1,
+ KeyValue.Type.Maximum);
results[0] = Result.create(new Cell[] { kv1 });
RpcRetryingCaller<Result[]> caller = Mockito.mock(RpcRetryingCaller.class);
@@ -395,13 +394,13 @@ public class TestClientScanner {
@SuppressWarnings("unchecked")
public void testMoreResults() throws IOException {
final Result[] results1 = new Result[1];
- KeyValue kv1 =
- new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1, Type.Maximum);
+ KeyValue kv1 = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1,
+ KeyValue.Type.Maximum);
results1[0] = Result.create(new Cell[] { kv1 });
final Result[] results2 = new Result[1];
KeyValue kv2 = new KeyValue(Bytes.toBytes("row2"), Bytes.toBytes("cf"), Bytes.toBytes("cq"), 1,
- Type.Maximum);
+ KeyValue.Type.Maximum);
results2[0] = Result.create(new Cell[] { kv2 });
RpcRetryingCaller<Result[]> caller = Mockito.mock(RpcRetryingCaller.class);
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestCoprocessorDescriptor.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestCoprocessorDescriptor.java
index f1a8e000136..a56c863ce61 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestCoprocessorDescriptor.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestCoprocessorDescriptor.java
@@ -33,8 +33,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@Category({ MiscTests.class, SmallTests.class })
public class TestCoprocessorDescriptor {
@@ -43,8 +41,6 @@ public class TestCoprocessorDescriptor {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestCoprocessorDescriptor.class);
- private static final Logger LOG = LoggerFactory.getLogger(TestCoprocessorDescriptor.class);
-
@Rule
public TestName name = new TestName();
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
index 95e05911008..a690be27acf 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
@@ -250,8 +250,7 @@ public class TestGet {
public void testGetRowConstructor() {
byte[] row1 = Bytes.toBytes("testRow");
byte[] row2 = Bytes.toBytes("testtestRow");
- ByteBuffer rowBuffer = ByteBuffer.allocate(16);
- rowBuffer = ByteBuffer.wrap(row1);
+ ByteBuffer rowBuffer = ByteBuffer.wrap(row1);
Get get1 = new Get(rowBuffer);
Get get2 = new Get(row2, 4, 7);
Assert.assertArrayEquals(get1.getRow(), get2.getRow());
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHTableDescriptor.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHTableDescriptor.java
index a121219443d..be0649f3751 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHTableDescriptor.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHTableDescriptor.java
@@ -97,6 +97,7 @@ public class TestImmutableHTableDescriptor {
hcd.setBlocksize(10);
fail("ImmutableHColumnDescriptor can't be modified!!!");
} catch (UnsupportedOperationException e) {
+ // Expected
}
}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestMutation.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestMutation.java
index dcb4d6eb88a..718ca05b92f 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestMutation.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestMutation.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.List;
import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.Cell.Type;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellUtil;
@@ -51,7 +50,7 @@ public class TestMutation {
byte[] family = Bytes.toBytes("CF-01");
origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(origin.getRow())
- .setFamily(family).setQualifier(Bytes.toBytes("q")).setType(Type.Put)
+ .setFamily(family).setQualifier(Bytes.toBytes("q")).setType(Cell.Type.Put)
.setValue(Bytes.toBytes(100)).build());
origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
origin.setTimeRange(100, 1000);
@@ -89,7 +88,7 @@ public class TestMutation {
byte[] family = Bytes.toBytes("CF-01");
origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(origin.getRow())
- .setFamily(family).setQualifier(Bytes.toBytes("q")).setType(Type.Delete).build());
+ .setFamily(family).setQualifier(Bytes.toBytes("q")).setType(Cell.Type.Delete).build());
origin.addColumn(family, Bytes.toBytes("q0"));
origin.addColumns(family, Bytes.toBytes("q1"));
origin.addFamily(family);
@@ -187,10 +186,11 @@ public class TestMutation {
Put put = new Put(row, true);
put
.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(row).setFamily(family)
- .setQualifier(qualifier0).setTimestamp(put.getTimestamp()).setType(Type.Put)
+ .setQualifier(qualifier0).setTimestamp(put.getTimestamp()).setType(Cell.Type.Put)
.setValue(value0).build())
.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(row).setFamily(family)
- .setQualifier(qualifier1).setTimestamp(ts1).setType(Type.Put).setValue(value1).build());
+ .setQualifier(qualifier1).setTimestamp(ts1).setType(Cell.Type.Put).setValue(value1)
+ .build());
// Verify the cell of family:qualifier0
Cell cell0 = put.get(family, qualifier0).get(0);
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
index 922b5fdce99..678eb28ce2e 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestRegionInfoDisplay.java
@@ -88,8 +88,8 @@ public class TestRegionInfoDisplay {
String firstPartOrig = origDesc.substring(0, origDesc.indexOf(Bytes.toStringBinary(startKey)));
String secondPartOrig = origDesc.substring(
origDesc.indexOf(Bytes.toStringBinary(startKey)) + Bytes.toStringBinary(startKey).length());
- assert (firstPart.equals(firstPartOrig));
- assert (secondPart.equals(secondPartOrig));
+ Assert.assertTrue(firstPart.equals(firstPartOrig));
+ Assert.assertTrue(secondPart.equals(secondPartOrig));
}
private void checkEquality(RegionInfo ri, Configuration conf) throws IOException {
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
index 8fe447e7fbd..66e83959718 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
@@ -165,22 +165,17 @@ public class TestScan {
@Test
public void testSetAuthorizations() {
Scan scan = new Scan();
- try {
- scan.setAuthorizations(new Authorizations("\u002b|\u0029"));
- scan.setAuthorizations(new Authorizations("A", "B", "0123", "A0", "1A1", "_a"));
- scan.setAuthorizations(new Authorizations("A|B"));
- scan.setAuthorizations(new Authorizations("A&B"));
- scan.setAuthorizations(new Authorizations("!B"));
- scan.setAuthorizations(new Authorizations("A", "(A)"));
- scan.setAuthorizations(new Authorizations("A", "{A"));
- scan.setAuthorizations(new Authorizations(" "));
- scan.setAuthorizations(new Authorizations(":B"));
- scan.setAuthorizations(new Authorizations("-B"));
- scan.setAuthorizations(new Authorizations(".B"));
- scan.setAuthorizations(new Authorizations("/B"));
- } catch (IllegalArgumentException e) {
- fail("should not throw exception");
- }
+ scan.setAuthorizations(new Authorizations("A", "B", "0123", "A0", "1A1", "_a"));
+ scan.setAuthorizations(new Authorizations("A|B"));
+ scan.setAuthorizations(new Authorizations("A&B"));
+ scan.setAuthorizations(new Authorizations("!B"));
+ scan.setAuthorizations(new Authorizations("A", "(A)"));
+ scan.setAuthorizations(new Authorizations("A", "{A"));
+ scan.setAuthorizations(new Authorizations(" "));
+ scan.setAuthorizations(new Authorizations(":B"));
+ scan.setAuthorizations(new Authorizations("-B"));
+ scan.setAuthorizations(new Authorizations(".B"));
+ scan.setAuthorizations(new Authorizations("/B"));
}
@Test
@@ -193,8 +188,7 @@ public class TestScan {
scan.setStartRow(new byte[HConstants.MAX_ROW_LENGTH + 1]);
fail("should've thrown exception");
} catch (IllegalArgumentException iae) {
- } catch (Exception e) {
- fail("expected IllegalArgumentException to be thrown");
+ // Expected
}
scan.setStopRow(null);
@@ -204,8 +198,7 @@ public class TestScan {
scan.setStopRow(new byte[HConstants.MAX_ROW_LENGTH + 1]);
fail("should've thrown exception");
} catch (IllegalArgumentException iae) {
- } catch (Exception e) {
- fail("expected IllegalArgumentException to be thrown");
+ // Expected
}
}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSimpleRequestController.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSimpleRequestController.java
index 36da042628a..6cb9960b96b 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSimpleRequestController.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSimpleRequestController.java
@@ -27,6 +27,7 @@ import java.io.InterruptedIOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import java.util.TreeMap;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicInteger;
@@ -100,9 +101,10 @@ public class TestSimpleRequestController {
Configuration conf = HBaseConfiguration.create();
conf.setLong(key, value);
try {
- SimpleRequestController controller = new SimpleRequestController(conf);
+ new SimpleRequestController(conf);
fail("The " + key + " must be bigger than zero");
} catch (IllegalArgumentException e) {
+ // Expected
}
}
@@ -122,7 +124,7 @@ public class TestSimpleRequestController {
final int maxConcurrentTasksPerRegion = 1;
final AtomicLong tasksInProgress = new AtomicLong(0);
final Map<ServerName, AtomicInteger> taskCounterPerServer = new HashMap<>();
- final Map<byte[], AtomicInteger> taskCounterPerRegion = new HashMap<>();
+ final Map<byte[], AtomicInteger> taskCounterPerRegion = new TreeMap<>(Bytes.BYTES_COMPARATOR);
SimpleRequestController.TaskCountChecker countChecker =
new SimpleRequestController.TaskCountChecker(maxTotalConcurrentTasks,
maxConcurrentTasksPerServer, maxConcurrentTasksPerRegion, tasksInProgress,
@@ -285,7 +287,7 @@ public class TestSimpleRequestController {
int maxConcurrentTasksPerRegion = 1;
AtomicLong tasksInProgress = new AtomicLong(0);
Map<ServerName, AtomicInteger> taskCounterPerServer = new HashMap<>();
- Map<byte[], AtomicInteger> taskCounterPerRegion = new HashMap<>();
+ Map<byte[], AtomicInteger> taskCounterPerRegion = new TreeMap<>(Bytes.BYTES_COMPARATOR);
SimpleRequestController.TaskCountChecker checker = new SimpleRequestController.TaskCountChecker(
maxTotalConcurrentTasks, maxConcurrentTasksPerServer, maxConcurrentTasksPerRegion,
tasksInProgress, taskCounterPerServer, taskCounterPerRegion);
@@ -359,10 +361,8 @@ public class TestSimpleRequestController {
try {
barrier.await();
controller.waitForMaximumCurrentTasks(max.get(), 123, 1, null);
- } catch (InterruptedIOException e) {
+ } catch (InterruptedIOException | InterruptedException | BrokenBarrierException e) {
Assert.fail(e.getMessage());
- } catch (InterruptedException | BrokenBarrierException e) {
- e.printStackTrace();
}
};
// First test that our runnable thread only exits when tasks is zero.
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTableDescriptorBuilder.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTableDescriptorBuilder.java
index 6aa4e6765e4..053b15d477c 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTableDescriptorBuilder.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestTableDescriptorBuilder.java
@@ -59,8 +59,8 @@ public class TestTableDescriptorBuilder {
@Test(expected = IOException.class)
public void testAddCoprocessorTwice() throws IOException {
String cpName = "a.b.c.d";
- TableDescriptor htd = TableDescriptorBuilder.newBuilder(TableName.META_TABLE_NAME)
- .setCoprocessor(cpName).setCoprocessor(cpName).build();
+ TableDescriptorBuilder.newBuilder(TableName.META_TABLE_NAME).setCoprocessor(cpName)
+ .setCoprocessor(cpName).build();
}
@Test
@@ -327,7 +327,7 @@ public class TestTableDescriptorBuilder {
public void testModifyInexistentFamily() {
byte[] familyName = Bytes.toBytes("cf");
HColumnDescriptor hcd = new HColumnDescriptor(familyName);
- TableDescriptor htd = TableDescriptorBuilder.newBuilder(TableName.valueOf(name.getMethodName()))
+ TableDescriptorBuilder.newBuilder(TableName.valueOf(name.getMethodName()))
.modifyColumnFamily(hcd).build();
}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/filter/TestKeyOnlyFilter.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/filter/TestKeyOnlyFilter.java
index df17570a80a..f1f1e37ff52 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/filter/TestKeyOnlyFilter.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/filter/TestKeyOnlyFilter.java
@@ -27,7 +27,6 @@ import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseCommonTestingUtility;
import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.filter.KeyOnlyFilter.KeyOnlyByteBufferExtendedCell;
import org.apache.hadoop.hbase.filter.KeyOnlyFilter.KeyOnlyCell;
@@ -64,7 +63,8 @@ public class TestKeyOnlyFilter {
byte[] q = Bytes.toBytes("qual1");
byte[] v = Bytes.toBytes("val1");
byte[] tags = Bytes.toBytes("tag1");
- KeyValue kv = new KeyValue(r, f, q, 0, q.length, 1234L, Type.Put, v, 0, v.length, tags);
+ KeyValue kv =
+ new KeyValue(r, f, q, 0, q.length, 1234L, KeyValue.Type.Put, v, 0, v.length, tags);
ByteBuffer buffer = ByteBuffer.wrap(kv.getBuffer());
ByteBufferKeyValue bbCell = new ByteBufferKeyValue(buffer, 0, buffer.remaining());
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestCellBlockBuilder.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestCellBlockBuilder.java
index f9c93811b4e..fccea923635 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestCellBlockBuilder.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestCellBlockBuilder.java
@@ -154,7 +154,7 @@ public class TestCellBlockBuilder {
StopWatch timer = new StopWatch();
timer.start();
for (int i = 0; i < cycles; i++) {
- timerTest(builder, timer, count, size, codec, compressor, false);
+ timerTest(builder, count, size, codec, compressor, false);
}
timer.stop();
LOG.info("Codec=" + codec + ", compression=" + compressor + ", sized=" + false + ", count="
@@ -162,16 +162,15 @@ public class TestCellBlockBuilder {
timer.reset();
timer.start();
for (int i = 0; i < cycles; i++) {
- timerTest(builder, timer, count, size, codec, compressor, true);
+ timerTest(builder, count, size, codec, compressor, true);
}
timer.stop();
LOG.info("Codec=" + codec + ", compression=" + compressor + ", sized=" + true + ", count="
+ count + ", size=" + size + ", + took=" + timer.getTime() + "ms");
}
- private static void timerTest(final CellBlockBuilder builder, final StopWatch timer,
- final int count, final int size, final Codec codec, final CompressionCodec compressor,
- final boolean sized) throws IOException {
+ private static void timerTest(final CellBlockBuilder builder, final int count, final int size,
+ final Codec codec, final CompressionCodec compressor, final boolean sized) throws IOException {
doBuildCellBlockUndoCellBlock(builder, codec, compressor, count, size, sized);
}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestNettyRpcConnection.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestNettyRpcConnection.java
index a9c40fd3bb7..73f3653a902 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestNettyRpcConnection.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestNettyRpcConnection.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.ipc;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
@@ -69,9 +70,8 @@ public class TestNettyRpcConnection {
@Test
public void testPrivateMethodExecutedInEventLoop() throws IllegalAccessException {
- // make sure the test is executed with "-ea"
assertThrows(AssertionError.class, () -> {
- assert false;
+ assertTrue(false);
});
for (Method method : NettyRpcConnection.class.getDeclaredMethods()) {
if (Modifier.isPrivate(method.getModifiers()) && !method.getName().contains("$")) {
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaGlobalsSettingsBypass.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaGlobalsSettingsBypass.java
index e2843180938..a3c96eb45aa 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaGlobalsSettingsBypass.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaGlobalsSettingsBypass.java
@@ -143,6 +143,7 @@ public class TestQuotaGlobalsSettingsBypass {
one.merge(two);
fail("Expected to see an Exception merging " + two + " into " + one);
} catch (IllegalArgumentException e) {
+ // Expected
}
}
}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/security/TestHBaseSaslRpcClient.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/security/TestHBaseSaslRpcClient.java
index 60bd80fb58f..7b42ba224fa 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/security/TestHBaseSaslRpcClient.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/security/TestHBaseSaslRpcClient.java
@@ -138,14 +138,8 @@ public class TestHBaseSaslRpcClient {
@Test
public void testHBaseSaslRpcClientCreation() throws Exception {
// creation kerberos principal check section
- assertFalse(assertSuccessCreationKerberosPrincipal(null));
- assertFalse(assertSuccessCreationKerberosPrincipal("DOMAIN.COM"));
- assertFalse(assertSuccessCreationKerberosPrincipal("principal/DOMAIN.COM"));
- if (!assertSuccessCreationKerberosPrincipal("principal/localhost@DOMAIN.COM")) {
- // XXX: This can fail if kerberos support in the OS is not sane, see HBASE-10107.
- // For now, don't assert, just warn
- LOG.warn("Could not create a SASL client with valid Kerberos credential");
- }
+ // Note this is mocked in a way that doesn't care about principal names
+ assertFalse(assertSuccessCreationKerberos());
// creation digest principal check section
assertFalse(assertSuccessCreationDigestPrincipal(null, null));
@@ -155,9 +149,8 @@ public class TestHBaseSaslRpcClient {
assertTrue(assertSuccessCreationDigestPrincipal(DEFAULT_USER_NAME, DEFAULT_USER_PASSWORD));
// creation simple principal check section
- assertFalse(assertSuccessCreationSimplePrincipal("", ""));
- assertFalse(assertSuccessCreationSimplePrincipal(null, null));
- assertFalse(assertSuccessCreationSimplePrincipal(DEFAULT_USER_NAME, DEFAULT_USER_PASSWORD));
+ // Note this is mocked in a way that doesn't care about principal names
+ assertFalse(assertSuccessCreationSimple());
// exceptions check section
assertTrue(assertIOExceptionThenSaslClientIsNull(DEFAULT_USER_NAME, DEFAULT_USER_PASSWORD));
@@ -245,10 +238,11 @@ public class TestHBaseSaslRpcClient {
}
}
- private boolean assertSuccessCreationKerberosPrincipal(String principal) {
+ private boolean assertSuccessCreationKerberos() {
HBaseSaslRpcClient rpcClient = null;
try {
- rpcClient = createSaslRpcClientForKerberos(principal);
+ // createSaslRpcClientForKerberos is mocked in a way that doesn't care about principal names
+ rpcClient = createSaslRpcClientForKerberos();
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
}
@@ -268,17 +262,17 @@ public class TestHBaseSaslRpcClient {
return rpcClient != null;
}
- private boolean assertSuccessCreationSimplePrincipal(String principal, String password) {
+ private boolean assertSuccessCreationSimple() {
HBaseSaslRpcClient rpcClient = null;
try {
- rpcClient = createSaslRpcClientSimple(principal, password);
+ rpcClient = createSaslRpcClientSimple();
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
}
return rpcClient != null;
}
- private HBaseSaslRpcClient createSaslRpcClientForKerberos(String principal) throws IOException {
+ private HBaseSaslRpcClient createSaslRpcClientForKerberos() throws IOException {
return new HBaseSaslRpcClient(HBaseConfiguration.create(),
new GssSaslClientAuthenticationProvider(), createTokenMock(), Mockito.mock(InetAddress.class),
Mockito.mock(SecurityInfo.class), false);
@@ -294,8 +288,7 @@ public class TestHBaseSaslRpcClient {
return token;
}
- private HBaseSaslRpcClient createSaslRpcClientSimple(String principal, String password)
- throws IOException {
+ private HBaseSaslRpcClient createSaslRpcClientSimple() throws IOException {
return new HBaseSaslRpcClient(HBaseConfiguration.create(),
new SimpleSaslClientAuthenticationProvider(), createTokenMock(),
Mockito.mock(InetAddress.class), Mockito.mock(SecurityInfo.class), false);
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestRoundRobinPoolMap.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestRoundRobinPoolMap.java
index d7ce6265b8c..04ba2570eac 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestRoundRobinPoolMap.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestRoundRobinPoolMap.java
@@ -120,10 +120,10 @@ public class TestRoundRobinPoolMap extends PoolMapTestBase {
String value = Integer.toString(id.getAndIncrement());
String result = poolMap.getOrCreate(key, () -> value);
results.add(result);
-
- Thread.yield();
+ // Sleep for a short time to ensure a yield. Thread#yield has platform dependent behavior.
+ Thread.sleep(10);
}
- } catch (IOException e) {
+ } catch (Exception e) {
throw new CompletionException(e);
}
};
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java
index 45f533f1a73..d83944ef7f3 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java
@@ -95,10 +95,10 @@ public class TestThreadLocalPoolMap extends PoolMapTestBase {
for (int i = 0; i < 3; i++) {
String result = poolMap.getOrCreate(key, () -> myId);
assertEquals(myId, result);
-
- Thread.yield();
+ // Sleep for a short period of time to yield. Thread#yield is platform dependent.
+ Thread.sleep(10);
}
- } catch (IOException e) {
+ } catch (Exception e) {
throw new CompletionException(e);
}
};