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:
parent
158758c5bf
commit
4f28738010
@ -152,7 +152,7 @@ public class MiniRouterDFSCluster {
|
|||||||
/**
|
/**
|
||||||
* Router context.
|
* Router context.
|
||||||
*/
|
*/
|
||||||
public class RouterContext {
|
public static class RouterContext {
|
||||||
private Router router;
|
private Router router;
|
||||||
private FileContext fileContext;
|
private FileContext fileContext;
|
||||||
private String nameserviceId;
|
private String nameserviceId;
|
||||||
|
@ -129,7 +129,7 @@ public Iterator<FileRegion> iterator() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LevelDbWriter extends BlockAliasMap.Writer<FileRegion> {
|
static class LevelDbWriter extends BlockAliasMap.Writer<FileRegion> {
|
||||||
|
|
||||||
private InMemoryAliasMapProtocol aliasMap;
|
private InMemoryAliasMapProtocol aliasMap;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
@InterfaceStability.Unstable
|
@InterfaceStability.Unstable
|
||||||
public class RamDiskReplicaLruTracker extends RamDiskReplicaTracker {
|
public class RamDiskReplicaLruTracker extends RamDiskReplicaTracker {
|
||||||
|
|
||||||
private class RamDiskReplicaLru extends RamDiskReplica {
|
private static class RamDiskReplicaLru extends RamDiskReplica {
|
||||||
long lastUsedTime;
|
long lastUsedTime;
|
||||||
|
|
||||||
private RamDiskReplicaLru(String bpid, long blockId,
|
private RamDiskReplicaLru(String bpid, long blockId,
|
||||||
@ -88,7 +88,7 @@ synchronized void addReplica(final String bpid, final long blockId,
|
|||||||
}
|
}
|
||||||
RamDiskReplicaLru ramDiskReplicaLru =
|
RamDiskReplicaLru ramDiskReplicaLru =
|
||||||
new RamDiskReplicaLru(bpid, blockId, transientVolume,
|
new RamDiskReplicaLru(bpid, blockId, transientVolume,
|
||||||
lockedBytesReserved);
|
lockedBytesReserved);
|
||||||
map.put(blockId, ramDiskReplicaLru);
|
map.put(blockId, ramDiskReplicaLru);
|
||||||
replicasNotPersisted.add(ramDiskReplicaLru);
|
replicasNotPersisted.add(ramDiskReplicaLru);
|
||||||
}
|
}
|
||||||
|
@ -835,7 +835,7 @@ protected void readUnlock() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ZoneTraverseInfo extends TraverseInfo {
|
private static class ZoneTraverseInfo extends TraverseInfo {
|
||||||
private String ezKeyVerName;
|
private String ezKeyVerName;
|
||||||
|
|
||||||
ZoneTraverseInfo(String ezKeyVerName) {
|
ZoneTraverseInfo(String ezKeyVerName) {
|
||||||
|
@ -65,7 +65,7 @@ public class DebugAdmin extends Configured implements Tool {
|
|||||||
/**
|
/**
|
||||||
* All the debug commands we can run.
|
* All the debug commands we can run.
|
||||||
*/
|
*/
|
||||||
private DebugCommand DEBUG_COMMANDS[] = {
|
private final DebugCommand[] DEBUG_COMMANDS = {
|
||||||
new VerifyMetaCommand(),
|
new VerifyMetaCommand(),
|
||||||
new ComputeMetaCommand(),
|
new ComputeMetaCommand(),
|
||||||
new RecoverLeaseCommand(),
|
new RecoverLeaseCommand(),
|
||||||
@ -75,7 +75,7 @@ public class DebugAdmin extends Configured implements Tool {
|
|||||||
/**
|
/**
|
||||||
* The base class for debug commands.
|
* The base class for debug commands.
|
||||||
*/
|
*/
|
||||||
private abstract class DebugCommand {
|
private abstract static class DebugCommand {
|
||||||
final String name;
|
final String name;
|
||||||
final String usageText;
|
final String usageText;
|
||||||
final String helpText;
|
final String helpText;
|
||||||
@ -94,15 +94,15 @@ private abstract class DebugCommand {
|
|||||||
/**
|
/**
|
||||||
* The command for verifying a block metadata file and possibly block file.
|
* The command for verifying a block metadata file and possibly block file.
|
||||||
*/
|
*/
|
||||||
private class VerifyMetaCommand extends DebugCommand {
|
private static class VerifyMetaCommand extends DebugCommand {
|
||||||
VerifyMetaCommand() {
|
VerifyMetaCommand() {
|
||||||
super("verifyMeta",
|
super("verifyMeta",
|
||||||
"verifyMeta -meta <metadata-file> [-block <block-file>]",
|
"verifyMeta -meta <metadata-file> [-block <block-file>]",
|
||||||
" Verify HDFS metadata and block files. If a block file is specified, we" +
|
" Verify HDFS metadata and block files. If a block file is specified, we" +
|
||||||
System.lineSeparator() +
|
System.lineSeparator() +
|
||||||
" will verify that the checksums in the metadata file match the block" +
|
" will verify that the checksums in the metadata file match the block" +
|
||||||
System.lineSeparator() +
|
System.lineSeparator() +
|
||||||
" file.");
|
" file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int run(List<String> args) throws IOException {
|
int run(List<String> args) throws IOException {
|
||||||
@ -210,7 +210,7 @@ int run(List<String> args) throws IOException {
|
|||||||
/**
|
/**
|
||||||
* The command for verifying a block metadata file and possibly block file.
|
* The command for verifying a block metadata file and possibly block file.
|
||||||
*/
|
*/
|
||||||
private class ComputeMetaCommand extends DebugCommand {
|
private static class ComputeMetaCommand extends DebugCommand {
|
||||||
ComputeMetaCommand() {
|
ComputeMetaCommand() {
|
||||||
super("computeMeta",
|
super("computeMeta",
|
||||||
"computeMeta -block <block-file> -out <output-metadata-file>",
|
"computeMeta -block <block-file> -out <output-metadata-file>",
|
||||||
|
@ -599,7 +599,7 @@ protected MiniDFSCluster(Builder builder) throws IOException {
|
|||||||
builder.useConfiguredTopologyMappingClass);
|
builder.useConfiguredTopologyMappingClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DataNodeProperties {
|
public static class DataNodeProperties {
|
||||||
final DataNode datanode;
|
final DataNode datanode;
|
||||||
final Configuration conf;
|
final Configuration conf;
|
||||||
String[] dnArgs;
|
String[] dnArgs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user