Skip to content

Commit

Permalink
Mark fields as final in multiple modules (#4831)
Browse files Browse the repository at this point in the history
Modules updated include:

* hadoop-mapreduce
* compactor
* gc
* manager
  • Loading branch information
cshannon authored Aug 24, 2024
1 parent 9f13d84 commit 493ebd3
Show file tree
Hide file tree
Showing 44 changed files with 77 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @since 2.0.0
*/
public class KeyRangePartitioner extends Partitioner<Key,Writable> implements Configurable {
private RangePartitioner rp = new RangePartitioner();
private final RangePartitioner rp = new RangePartitioner();

@Override
public int getPartition(Key key, Writable value, int numPartitions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public class AccumuloRecordWriter implements RecordWriter<Text,Mutation> {
private static final Class<AccumuloOutputFormat> CLASS = AccumuloOutputFormat.class;
private static final Logger log = LoggerFactory.getLogger(AccumuloRecordWriter.class);
private MultiTableBatchWriter mtbw = null;
private HashMap<Text,BatchWriter> bws;
private Text defaultTableName;
private final HashMap<Text,BatchWriter> bws;
private final Text defaultTableName;

private boolean simulate;
private boolean createTables;
private final boolean simulate;
private final boolean createTables;

private long mutCount = 0;
private long valCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public class AccumuloRecordWriter extends RecordWriter<Text,Mutation> {
private static final Logger log = LoggerFactory.getLogger(AccumuloRecordWriter.class);
private MultiTableBatchWriter mtbw = null;
private final HashMap<Text,BatchWriter> bws;
private Text defaultTableName;
private final Text defaultTableName;

private boolean simulate;
private boolean createTables;
private final boolean simulate;
private final boolean createTables;

private long mutCount = 0;
private long valCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class FileOutputFormatBuilderImpl<T> implements FileOutputFormatBuilder,
FileOutputFormatBuilder.PathParams<T>, FileOutputFormatBuilder.OutputOptions<T> {

Class<?> callingClass;
final Class<?> callingClass;
Path outputPath;
Optional<String> comp = Optional.empty();
Optional<Long> dataBlockSize = Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class InputFormatBuilderImpl<T>
implements InputFormatBuilder, InputFormatBuilder.ClientParams<T>,
InputFormatBuilder.TableParams<T>, InputFormatBuilder.InputFormatOptions<T> {

private Class<?> callingClass;
private final Class<?> callingClass;
private Properties clientProps;
private String clientPropsPath;
private String currentTable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class OutputFormatBuilderImpl<T>
// optional values
private Optional<String> defaultTableName = Optional.empty();
private boolean createTables = false;
private boolean simulationMode = false;
private final boolean simulationMode = false;

public OutputFormatBuilderImpl(Class<?> callingClass) {
this.callingClass = callingClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
public class ExtCEnv implements CompactionEnv {

private final CompactionJobHolder jobHolder;
private TExternalCompactionJob job;
private String groupName;
private final TExternalCompactionJob job;
private final String groupName;

public static class CompactorIterEnv extends TabletIteratorEnvironment {

private String groupName;
private final String groupName;

public CompactorIterEnv(ServerContext context, IteratorScope scope, boolean fullMajC,
AccumuloConfiguration tableConfig, TableId tableId, CompactionKind kind, String groupName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class SimpleGarbageCollector extends AbstractServer implements Iface {
private final GcCycleMetrics gcCycleMetrics = new GcCycleMetrics();

private ServiceLock gcLock;
private Timer lastCompactorCheck = Timer.startNew();
private final Timer lastCompactorCheck = Timer.startNew();

SimpleGarbageCollector(ConfigOpts opts, String[] args) {
super("gc", opts, ServerContext::new, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ abstract class TabletGroupWatcher extends AccumuloDaemonThread {
private SortedSet<TServerInstance> lastScanServers = Collections.emptySortedSet();
private final EventHandler eventHandler;
private final ManagerMetrics metrics;
private WalStateManager walStateManager;
private final WalStateManager walStateManager;
private volatile Set<TServerInstance> filteredServersToShutdown = Set.of();

TabletGroupWatcher(Manager manager, TabletStateStore store, TabletGroupWatcher dependentWatcher,
Expand Down Expand Up @@ -411,7 +411,7 @@ private Set<TServerInstance> getFilteredServersToShutdown() {
}

private static class TableMgmtStats {
int[] counts = new int[TabletState.values().length];
final int[] counts = new int[TabletState.values().length];
private int totalUnloaded;
private long totalVolumeReplacements;
private int tabletsWithErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public class CompactionCoordinator
private final CompactionJobQueues jobQueues;
private final AtomicReference<Map<FateInstanceType,Fate<Manager>>> fateInstances;
// Exposed for tests
protected CountDownLatch shutdown = new CountDownLatch(1);
protected final CountDownLatch shutdown = new CountDownLatch(1);

private final ScheduledThreadPoolExecutor schedExecutor;

Expand All @@ -185,7 +185,7 @@ public class CompactionCoordinator
private final Cache<Path,Integer> tabletDirCache;
private final DeadCompactionDetector deadCompactionDetector;

private QueueMetrics queueMetrics;
private final QueueMetrics queueMetrics;
private final Manager manager;

private final LoadingCache<String,Integer> compactorCounts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public boolean equals(Object o) {
// efficiently removing entries from anywhere in the queue. Efficient removal is needed for the
// case where tablets decided to issues different compaction jobs than what is currently queued.
private final TreeMap<CjpqKey,CompactionJobQueues.MetaJob> jobQueue;
private AtomicInteger maxSize;
private final AtomicInteger maxSize;
private final AtomicLong rejectedJobs;
private final AtomicLong dequeuedJobs;
private final ArrayDeque<CompletableFuture<CompactionJobQueues.MetaJob>> futures;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ public class RecoveryManager {

private static final Logger log = LoggerFactory.getLogger(RecoveryManager.class);

private Map<String,Long> recoveryDelay = new HashMap<>();
private Set<String> closeTasksQueued = new HashSet<>();
private Set<String> sortsQueued = new HashSet<>();
private Cache<Path,Boolean> existenceCache;
private ScheduledExecutorService executor;
private Manager manager;
private ZooCache zooCache;
private final Map<String,Long> recoveryDelay = new HashMap<>();
private final Set<String> closeTasksQueued = new HashSet<>();
private final Set<String> sortsQueued = new HashSet<>();
private final Cache<Path,Boolean> existenceCache;
private final ScheduledExecutorService executor;
private final Manager manager;
private final ZooCache zooCache;

public RecoveryManager(Manager manager, long timeToCacheExistsInMillis) {
this.manager = manager;
Expand All @@ -88,10 +88,10 @@ public RecoveryManager(Manager manager, long timeToCacheExistsInMillis) {
}

private class LogSortTask implements Runnable {
private String source;
private String destination;
private String sortId;
private LogCloser closer;
private final String source;
private final String destination;
private final String sortId;
private final LogCloser closer;

public LogSortTask(LogCloser closer, String source, String destination, String sortId) {
this.closer = closer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SeedSplitTask implements Runnable {

private static final Logger log = LoggerFactory.getLogger(SeedSplitTask.class);
private final Manager manager;
private KeyExtent extent;
private final KeyExtent extent;

public SeedSplitTask(Manager manager, KeyExtent extent) {
this.manager = manager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public int hashCode() {

}

LoadingCache<CacheKey,FileInfo> splitFileCache;
final LoadingCache<CacheKey,FileInfo> splitFileCache;

public Splitter(ServerContext context) {
int numThreads = context.getConfiguration().getCount(Property.MANAGER_SPLIT_WORKER_THREADS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.accumulo.core.metadata.TabletState;

public class TableCounts {
int[] counts = new int[TabletState.values().length];
final int[] counts = new int[TabletState.values().length];

public int unassigned() {
return counts[TabletState.UNASSIGNED.ordinal()];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
public class ChangeTableState extends ManagerRepo {

private static final long serialVersionUID = 1L;
private TableId tableId;
private NamespaceId namespaceId;
private TableOperation top;
private final TableId tableId;
private final NamespaceId namespaceId;
private final TableOperation top;
private final EnumSet<TableState> expectedCurrStates;

public ChangeTableState(NamespaceId namespaceId, TableId tableId, TableOperation top,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class TraceRepo<T> implements Repo<T> {

private static final long serialVersionUID = 1L;

TInfo tinfo;
Repo<T> repo;
final TInfo tinfo;
final Repo<T> repo;

public TraceRepo(Repo<T> repo) {
this.repo = repo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class CleanUpBulkImport extends ManagerRepo {

private static final Logger log = LoggerFactory.getLogger(CleanUpBulkImport.class);

private BulkInfo info;
private final BulkInfo info;

public CleanUpBulkImport(BulkInfo info) {
this.info = info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class CloneMetadata extends ManagerRepo {

private static final long serialVersionUID = 1L;
private CloneInfo cloneInfo;
private final CloneInfo cloneInfo;

public CloneMetadata(CloneInfo cloneInfo) {
this.cloneInfo = cloneInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ClonePermissions extends ManagerRepo {

private static final long serialVersionUID = 1L;

private CloneInfo cloneInfo;
private final CloneInfo cloneInfo;

public ClonePermissions(CloneInfo cloneInfo) {
this.cloneInfo = cloneInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class CloneTable extends ManagerRepo {

private static final long serialVersionUID = 1L;
private CloneInfo cloneInfo;
private final CloneInfo cloneInfo;

public CloneTable(String user, NamespaceId namespaceId, TableId srcTableId, String tableName,
Map<String,String> propertiesToSet, Set<String> propertiesToExclude, boolean keepOffline) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CloneZookeeper extends ManagerRepo {

private static final long serialVersionUID = 1L;

private CloneInfo cloneInfo;
private final CloneInfo cloneInfo;

public CloneZookeeper(CloneInfo cloneInfo, ClientContext context)
throws NamespaceNotFoundException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
class FinishCloneTable extends ManagerRepo {

private static final long serialVersionUID = 1L;
private CloneInfo cloneInfo;
private final CloneInfo cloneInfo;

public FinishCloneTable(CloneInfo cloneInfo) {
this.cloneInfo = cloneInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class CompactRange extends ManagerRepo {
private final NamespaceId namespaceId;
private byte[] startRow;
private byte[] endRow;
private byte[] config;
private final byte[] config;

public CompactRange(NamespaceId namespaceId, TableId tableId, CompactionConfig compactionConfig)
throws AcceptableThriftTableOperationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public class CompactionDriver extends ManagerRepo {

private final TableId tableId;
private final NamespaceId namespaceId;
private byte[] startRow;
private byte[] endRow;
private final byte[] startRow;
private final byte[] endRow;

public CompactionDriver(NamespaceId namespaceId, TableId tableId, byte[] startRow,
byte[] endRow) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
public class CancelCompactions extends ManagerRepo {

private static final long serialVersionUID = 1L;
private TableId tableId;
private NamespaceId namespaceId;
private final TableId tableId;
private final NamespaceId namespaceId;

private static final Logger log = LoggerFactory.getLogger(CancelCompactions.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

class FinishCancelCompaction extends ManagerRepo {
private static final long serialVersionUID = 1L;
private TableId tableId;
private NamespaceId namespaceId;
private final TableId tableId;
private final NamespaceId namespaceId;

public FinishCancelCompaction(NamespaceId namespaceId, TableId tableId) {
this.tableId = tableId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SetupPermissions extends ManagerRepo {

private static final long serialVersionUID = 1L;

private TableInfo tableInfo;
private final TableInfo tableInfo;

SetupPermissions(TableInfo ti) {
this.tableInfo = ti;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class CleanUp extends ManagerRepo {

private static final long serialVersionUID = 1L;

private TableId tableId;
private NamespaceId namespaceId;
private final TableId tableId;
private final NamespaceId namespaceId;

private long creationTime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class DeleteTable extends ManagerRepo {

private static final long serialVersionUID = 1L;

private TableId tableId;
private NamespaceId namespaceId;
private final TableId tableId;
private final NamespaceId namespaceId;

public DeleteTable(NamespaceId namespaceId, TableId tableId) {
this.namespaceId = namespaceId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public static String createDeleteMarkerPath(InstanceId instanceId, TableId table

private static final long serialVersionUID = 1L;

private TableId tableId;
private NamespaceId namespaceId;
private final TableId tableId;
private final NamespaceId namespaceId;

public PreDeleteTable(NamespaceId namespaceId, TableId tableId) {
this.tableId = tableId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class CreateNamespace extends ManagerRepo {
private static final long serialVersionUID = 1L;

private NamespaceInfo namespaceInfo;
private final NamespaceInfo namespaceInfo;

public CreateNamespace(String user, String namespaceName, Map<String,String> props) {
namespaceInfo = new NamespaceInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FinishCreateNamespace extends ManagerRepo {

private static final long serialVersionUID = 1L;

private NamespaceInfo namespaceInfo;
private final NamespaceInfo namespaceInfo;

public FinishCreateNamespace(NamespaceInfo ti) {
this.namespaceInfo = ti;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SetupNamespacePermissions extends ManagerRepo {

private static final long serialVersionUID = 1L;

private NamespaceInfo namespaceInfo;
private final NamespaceInfo namespaceInfo;

public SetupNamespacePermissions(NamespaceInfo ti) {
this.namespaceInfo = ti;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class DeleteNamespace extends ManagerRepo {

private static final long serialVersionUID = 1L;

private NamespaceId namespaceId;
private final NamespaceId namespaceId;

public DeleteNamespace(NamespaceId namespaceId) {
this.namespaceId = namespaceId;
Expand Down
Loading

0 comments on commit 493ebd3

Please sign in to comment.