@SuppressWarnings("unchecked") Conf(Configuration conf) { this.targetBytesPerSec = Math.max(0L, conf.getLong( DFS_BLOCK_SCANNER_VOLUME_BYTES_PER_SECOND, DFS_BLOCK_SCANNER_VOLUME_BYTES_PER_SECOND_DEFAULT)); this.maxStalenessMs = Math.max(0L, getUnitTestLong(conf, INTERNAL_DFS_BLOCK_SCANNER_MAX_STALENESS_MS, INTERNAL_DFS_BLOCK_SCANNER_MAX_STALENESS_MS_DEFAULT)); this.scanPeriodMs = getConfiguredScanPeriodMs(conf); this.cursorSaveMs = Math.max(0L, getUnitTestLong(conf, INTERNAL_DFS_BLOCK_SCANNER_CURSOR_SAVE_INTERVAL_MS, INTERNAL_DFS_BLOCK_SCANNER_CURSOR_SAVE_INTERVAL_MS_DEFAULT)); if (allowUnitTestSettings) { this.resultHandler = (Class<? extends ScanResultHandler>) conf.getClass(INTERNAL_VOLUME_SCANNER_SCAN_RESULT_HANDLER, ScanResultHandler.class); } else { this.resultHandler = ScanResultHandler.class; } }
@SuppressWarnings("unchecked") Conf(Configuration conf) { this.targetBytesPerSec = Math.max(0L, conf.getLong( DFS_BLOCK_SCANNER_VOLUME_BYTES_PER_SECOND, DFS_BLOCK_SCANNER_VOLUME_BYTES_PER_SECOND_DEFAULT)); this.maxStalenessMs = Math.max(0L, getUnitTestLong(conf, INTERNAL_DFS_BLOCK_SCANNER_MAX_STALENESS_MS, INTERNAL_DFS_BLOCK_SCANNER_MAX_STALENESS_MS_DEFAULT)); this.scanPeriodMs = Math.max(0L, getUnitTestLong(conf, INTERNAL_DFS_DATANODE_SCAN_PERIOD_MS, TimeUnit.MILLISECONDS.convert(conf.getLong( DFS_DATANODE_SCAN_PERIOD_HOURS_KEY, DFS_DATANODE_SCAN_PERIOD_HOURS_DEFAULT), TimeUnit.HOURS))); this.cursorSaveMs = Math.max(0L, getUnitTestLong(conf, INTERNAL_DFS_BLOCK_SCANNER_CURSOR_SAVE_INTERVAL_MS, INTERNAL_DFS_BLOCK_SCANNER_CURSOR_SAVE_INTERVAL_MS_DEFAULT)); if (allowUnitTestSettings) { this.resultHandler = (Class<? extends ScanResultHandler>) conf.getClass(INTERNAL_VOLUME_SCANNER_SCAN_RESULT_HANDLER, ScanResultHandler.class); } else { this.resultHandler = ScanResultHandler.class; } }