HDFS-15931 : Fix non-static inner classes for better memory management (#2830). Contributed by Viraj Jasani

Signed-off-by: Mingliang Liu <liuml07@apache.org>
This commit is contained in:
Viraj Jasani 2021-04-02 05:04:31 +05:30 committed by Mingliang Liu
parent 93517ba9bc
commit 5458ebf607
No known key found for this signature in database
GPG Key ID: BC2FB8C6908A0C16
6 changed files with 16 additions and 16 deletions

View File

@ -140,7 +140,7 @@ public class MiniRouterDFSCluster {
/**
* Router context.
*/
public class RouterContext {
public static class RouterContext {
private Router router;
private FileContext fileContext;
private String nameserviceId;

View File

@ -130,7 +130,7 @@ public class InMemoryLevelDBAliasMapClient extends BlockAliasMap<FileRegion>
}
}
class LevelDbWriter extends BlockAliasMap.Writer<FileRegion> {
static class LevelDbWriter extends BlockAliasMap.Writer<FileRegion> {
private InMemoryAliasMapProtocol aliasMap;

View File

@ -35,7 +35,7 @@ import java.util.*;
@InterfaceStability.Unstable
public class RamDiskReplicaLruTracker extends RamDiskReplicaTracker {
private class RamDiskReplicaLru extends RamDiskReplica {
private static class RamDiskReplicaLru extends RamDiskReplica {
long lastUsedTime;
private RamDiskReplicaLru(String bpid, long blockId,

View File

@ -835,7 +835,7 @@ public class ReencryptionHandler implements Runnable {
}
}
private class ZoneTraverseInfo extends TraverseInfo {
private static class ZoneTraverseInfo extends TraverseInfo {
private String ezKeyVerName;
ZoneTraverseInfo(String ezKeyVerName) {

View File

@ -64,7 +64,7 @@ public class DebugAdmin extends Configured implements Tool {
/**
* All the debug commands we can run.
*/
private DebugCommand DEBUG_COMMANDS[] = {
private final DebugCommand[] DEBUG_COMMANDS = {
new VerifyMetaCommand(),
new ComputeMetaCommand(),
new RecoverLeaseCommand(),
@ -74,7 +74,7 @@ public class DebugAdmin extends Configured implements Tool {
/**
* The base class for debug commands.
*/
private abstract class DebugCommand {
private abstract static class DebugCommand {
final String name;
final String usageText;
final String helpText;
@ -93,7 +93,7 @@ public class DebugAdmin extends Configured implements Tool {
/**
* The command for verifying a block metadata file and possibly block file.
*/
private class VerifyMetaCommand extends DebugCommand {
private static class VerifyMetaCommand extends DebugCommand {
VerifyMetaCommand() {
super("verifyMeta",
"verifyMeta -meta <metadata-file> [-block <block-file>]",
@ -209,7 +209,7 @@ public class DebugAdmin extends Configured implements Tool {
/**
* The command for verifying a block metadata file and possibly block file.
*/
private class ComputeMetaCommand extends DebugCommand {
private static class ComputeMetaCommand extends DebugCommand {
ComputeMetaCommand() {
super("computeMeta",
"computeMeta -block <block-file> -out <output-metadata-file>",

View File

@ -562,7 +562,7 @@ public class MiniDFSCluster implements AutoCloseable {
builder.useConfiguredTopologyMappingClass);
}
public class DataNodeProperties {
public static class DataNodeProperties {
final DataNode datanode;
final Configuration conf;
String[] dnArgs;