diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/TenantCacheImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/TenantCacheImpl.java index 6a866a18060..12078ca2c32 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/cache/TenantCacheImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/TenantCacheImpl.java @@ -65,7 +65,7 @@ public class TenantCacheImpl implements TenantCache { private final long EVICTION_MARGIN_BYTES = 10000000; - private class CacheEntry implements Comparable, Closeable { + private static class CacheEntry implements Comparable, Closeable { private ImmutableBytesPtr cacheId; private ImmutableBytesWritable cachePtr; private int hits; @@ -247,9 +247,9 @@ public Closeable addServerCache(ImmutableBytesPtr cacheId, ImmutableBytesWritabl entry = getIfPresent(cacheId); if (entry == null) { entry = new CacheEntry( - cacheId, cachePtr, cacheFactory, txState, chunk, - usePersistentCache, useProtoForIndexMaintainer, - clientVersion); + cacheId, cachePtr, cacheFactory, txState, chunk, + usePersistentCache, useProtoForIndexMaintainer, + clientVersion); getServerCaches().put(cacheId, entry); if (usePersistentCache) { getPersistentServerCaches().put(cacheId, entry); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java index c39621f9623..7e5cdbefec7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java @@ -1240,7 +1240,7 @@ private PDatum getPDatumByExpression(Expression expression, PDataType pDataTypeI return new PDatumImpl(expression, pDataTypeInput); } - private class PDatumImpl implements PDatum { + private static class PDatumImpl implements PDatum { private final boolean isNullable; private final PDataType dataType; @@ -1283,7 +1283,7 @@ public SortOrder getSortOrder() { } - private class ExpressionDeterminism { + private static class ExpressionDeterminism { private ArithmeticParseNode node; private List children; private PDataType theType; diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java index 179267400c9..b41c6ab7a97 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java @@ -2428,8 +2428,8 @@ public void dropTable(RpcController controller, DropTableRequest request, ServerUtil.releaseRowLocks(locks); if (dropTableStats) { Thread statsDeleteHandler = new Thread(new StatsDeleteHandler(env, - loadedTable, tableNamesToDelete, sharedTablesToDelete), - "thread-statsdeletehandler"); + loadedTable, tableNamesToDelete, sharedTablesToDelete), + "thread-statsdeletehandler"); statsDeleteHandler.setDaemon(true); statsDeleteHandler.start(); } @@ -2441,7 +2441,7 @@ public void dropTable(RpcController controller, DropTableRequest request, } } - class StatsDeleteHandler implements Runnable { + private static class StatsDeleteHandler implements Runnable { PTable deletedTable; List physicalTableNames; List sharedTableStates; @@ -2485,6 +2485,7 @@ public Object run() throws Exception { } } } + private RowLock acquireLock(Region region, byte[] lockKey, List locks) throws IOException { RowLock rowLock = region.getRowLock(lockKey, false); if (rowLock == null) { diff --git a/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java index df81957f8de..9655cd814de 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/filter/RowKeyComparisonFilter.java @@ -43,7 +43,7 @@ public class RowKeyComparisonFilter extends BooleanExpressionFilter { private boolean evaluate = true; private boolean keepRow = false; - private RowKeyTuple inputTuple = new RowKeyTuple(); + private final RowKeyTuple inputTuple = new RowKeyTuple(); private byte[] essentialCF; public RowKeyComparisonFilter() { @@ -79,7 +79,7 @@ public ReturnCode filterKeyValue(Cell v) { return keepRow ? ReturnCode.INCLUDE_AND_NEXT_COL : ReturnCode.NEXT_ROW; } - private final class RowKeyTuple extends BaseTuple { + private static final class RowKeyTuple extends BaseTuple { private byte[] buf; private int offset; private int length; diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java index ac1b72ccba4..5b2585ed59e 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/ApplyAndFilterDeletesFilter.java @@ -199,7 +199,7 @@ public Cell getHint(Cell peeked) { * Hint the next column-qualifier after the given keyvalue. We can't be smart like in the * ScanQueryMatcher since we don't know the columns ahead of time. */ - class DeleteColumnHinter implements Hinter { + private static class DeleteColumnHinter implements Hinter { @Override public Cell getHint(Cell kv) { diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java index e628ef12a4d..b06fd4f5953 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/update/IndexUpdateManager.java @@ -17,6 +17,7 @@ */ package org.apache.phoenix.hbase.index.covered.update; +import java.io.Serializable; import java.util.Collection; import java.util.Comparator; import java.util.HashMap; @@ -43,7 +44,9 @@ public class IndexUpdateManager { public Comparator COMPARATOR = new MutationComparator(); - class MutationComparator implements Comparator { + + private static class MutationComparator implements Comparator, + Serializable { @Override public int compare(Mutation o1, Mutation o2) { diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java b/phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java index 9415f534ec2..eb6a6980c1d 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java @@ -118,7 +118,7 @@ public int getValue() { * An instance of this class is created for each scanner on an index * and used to verify individual rows and rebuild them if they are not valid */ - private class GlobalIndexScanner implements RegionScanner { + private static class GlobalIndexScanner implements RegionScanner { private RegionScanner scanner; private RegionScanner deleteRowScanner; private long ageThreshold; diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index 1d53b6e3bd9..8e0171a3944 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -1281,7 +1281,7 @@ public List getIterators() throws SQLException { .getInt(QueryConstants.HASH_JOIN_CACHE_RETRIES, QueryConstants.DEFAULT_HASH_JOIN_CACHE_RETRIES)); } - class ScanWrapper { + private static class ScanWrapper { Scan scan; public Scan getScan() { diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/RoundRobinResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/RoundRobinResultIterator.java index da6f5b1c82c..5f0dcd29bb8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/RoundRobinResultIterator.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/RoundRobinResultIterator.java @@ -291,7 +291,7 @@ public Tuple call() throws Exception { * keeps track of the tuple the {@link PeekingResultIterator} read in the previous next() call before it ran out of * underlying scanner cache. */ - private class RoundRobinIterator implements PeekingResultIterator { + private static class RoundRobinIterator implements PeekingResultIterator { private PeekingResultIterator delegate; private Tuple tuple; diff --git a/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java b/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java index ecf9d575030..8eabd3500de 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheFactory.java @@ -82,7 +82,7 @@ public Closeable newCache(ImmutableBytesWritable cachePtr, byte[] txState, Memor } @Immutable - private class HashCacheImpl implements HashCache { + private static class HashCacheImpl implements HashCache { private final Map> hashCache; private final MemoryChunk memoryChunk; private final boolean singleValueOnly; diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexScrutinyTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexScrutinyTool.java index 831d099f814..2ce496975b2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexScrutinyTool.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexScrutinyTool.java @@ -205,7 +205,7 @@ private void printHelpAndExit(Options options, int exitCode) { System.exit(exitCode); } - class JobFactory { + private static class JobFactory { Connection connection; Configuration configuration; private final boolean useSnapshot; @@ -456,8 +456,8 @@ public int run(String[] args) throws Exception { schemaName, dataTable, indexTable, useSnapshot, ts, batchSize, basePath, outputFormat, outputMaxRows)); JobFactory jobFactory = - new JobFactory(connection, configuration, batchSize, useSnapshot, ts, - outputInvalidRows, outputFormat, basePath, outputMaxRows, tenantId, mapperClass); + new JobFactory(connection, configuration, batchSize, useSnapshot, ts, + outputInvalidRows, outputFormat, basePath, outputMaxRows, tenantId, mapperClass); // If we are running the scrutiny with both tables as the source, run two separate jobs, // one for each direction if (SourceTable.BOTH.equals(sourceTable)) { diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java index 7b043e4853a..d7d99febfe9 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java @@ -843,7 +843,7 @@ private HashMap prepareToRebuildIndexes(Connection conn, tenantId); for (String viewIndex : viewIndexes) { IndexInfo indexInfo = new IndexInfo(schemaName, viewName, - tenantId == null ? GLOBAL_INDEX_ID : tenantId, viewIndex); + tenantId == null ? GLOBAL_INDEX_ID : tenantId, viewIndex); indexInfos.put(viewIndex, indexInfo); } } @@ -891,7 +891,7 @@ public static String getViewIndexesSql(String viewName, String schemaName, Strin " AND TENANT_ID = \'" + tenantId + "\'" : " AND TENANT_ID IS NULL"); } - private class IndexInfo { + private static class IndexInfo { final private String schemaName; final private String baseTable; final private String tenantId; diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index c878c1dc1da..61382f74984 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -5173,7 +5173,7 @@ else if (metaProperties.getImmutableStorageSchemeProp() != table.getImmutableSto return changingPhoenixTableProperty; } - class MetaProperties{ + private static class MetaProperties { private Boolean isImmutableRowsProp = null; private Boolean multiTenantProp = null; private Boolean disableWALProp = null; @@ -5299,7 +5299,7 @@ public void setChangeDetectionEnabled(Boolean isChangeDetectionEnabled) { } } - class MetaPropertiesEvaluated{ + private static class MetaPropertiesEvaluated { private Boolean isImmutableRows; private Boolean multiTenant = null; private Boolean disableWAL = null; diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollectionRunTracker.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollectionRunTracker.java index 7900fbb9c67..fabbad4967a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollectionRunTracker.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollectionRunTracker.java @@ -106,7 +106,7 @@ public boolean areStatsBeingCollectedOnCompaction(RegionInfo regionInfo) { * @return true if UPDATE STATISTICS wasn't already running on the region, false otherwise. */ public boolean addUpdateStatsCommandRegion(RegionInfo regionInfo, Set familySet) { - return updateStatsRegions.add(new ColumnFamilyRegionInfo(regionInfo,familySet)); + return updateStatsRegions.add(new ColumnFamilyRegionInfo(regionInfo, familySet)); } /** @@ -114,7 +114,7 @@ public boolean addUpdateStatsCommandRegion(RegionInfo regionInfo, Set fa * @return true if UPDATE STATISTICS was running on the region, false otherwise. */ public boolean removeUpdateStatsCommandRegion(RegionInfo regionInfo, Set familySet) { - return updateStatsRegions.remove(new ColumnFamilyRegionInfo(regionInfo,familySet)); + return updateStatsRegions.remove(new ColumnFamilyRegionInfo(regionInfo, familySet)); } /** @@ -126,9 +126,9 @@ public Future runTask(Callable c) { return executor.submit(c); } - class ColumnFamilyRegionInfo { - private RegionInfo regionInfo; - private Set familySet; + private static class ColumnFamilyRegionInfo { + private final RegionInfo regionInfo; + private final Set familySet; public ColumnFamilyRegionInfo(RegionInfo regionInfo, Set familySet) { this.regionInfo = regionInfo;