HDFS-14995. Use log variable directly instead of passing as argument in InvalidateBlocks#printBlockDeletionTime(). Contributed by Lisheng Sun.

This commit is contained in:
Surendra Singh Lilhore 2019-11-21 00:00:42 +05:30
parent be77231452
commit fd264b8265

View File

@ -41,8 +41,6 @@
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import org.slf4j.Logger;
/** /**
* Keeps a Collection for every named machine containing blocks * Keeps a Collection for every named machine containing blocks
* that have recently been invalidated and are thought to live * that have recently been invalidated and are thought to live
@ -72,17 +70,17 @@ class InvalidateBlocks {
this.blockInvalidateLimit = blockInvalidateLimit; this.blockInvalidateLimit = blockInvalidateLimit;
this.pendingPeriodInMs = pendingPeriodInMs; this.pendingPeriodInMs = pendingPeriodInMs;
this.blockIdManager = blockIdManager; this.blockIdManager = blockIdManager;
printBlockDeletionTime(BlockManager.LOG); printBlockDeletionTime();
} }
private void printBlockDeletionTime(final Logger log) { private void printBlockDeletionTime() {
log.info("{} is set to {}", BlockManager.LOG.info("{} is set to {}",
DFSConfigKeys.DFS_NAMENODE_STARTUP_DELAY_BLOCK_DELETION_SEC_KEY, DFSConfigKeys.DFS_NAMENODE_STARTUP_DELAY_BLOCK_DELETION_SEC_KEY,
DFSUtil.durationToString(pendingPeriodInMs)); DFSUtil.durationToString(pendingPeriodInMs));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMM dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMM dd HH:mm:ss");
Calendar calendar = new GregorianCalendar(); Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.SECOND, (int) (this.pendingPeriodInMs / 1000)); calendar.add(Calendar.SECOND, (int) (this.pendingPeriodInMs / 1000));
log.info("The block deletion will start around {}", BlockManager.LOG.info("The block deletion will start around {}",
sdf.format(calendar.getTime())); sdf.format(calendar.getTime()));
} }