Source:
protected RackawareEnsemblePlacementPolicyImpl initialize(DNSToSwitchMapping dnsResolver, HashedWheelTimer timer, boolean reorderReadsRandom, int stabilizePeriodSeconds, boolean isWeighted, int maxWeightMultiple, StatsLogger statsLogger) { this.statsLogger = statsLogger; this.bookiesJoinedCounter = statsLogger == null ? null : statsLogger.getOpStatsLogger(BookKeeperServerStats.BOOKIES_JOINED); this.bookiesLeftCounter = statsLogger == null ? null : statsLogger.getOpStatsLogger(BookKeeperServerStats.BOOKIES_LEFT); this.reorderReadsRandom = reorderReadsRandom; this.stabilizePeriodSeconds = stabilizePeriodSeconds; this.dnsResolver = new DNSResolverDecorator(dnsResolver, () -> this.getDefaultRack()); this.timer = timer; if (stabilizePeriodSeconds > 0) { this.topology = new StabilizeNetworkTopology(timer, stabilizePeriodSeconds); } else { this.topology = new NetworkTopologyImpl(); } BookieNode bn; try { bn = createBookieNode(new BookieSocketAddress(InetAddress.getLocalHost().getHostAddress(), 0)); } catch (UnknownHostException e) { LOG.error("Failed to get local host address : ", e); bn = null; } localNode = bn; LOG.info("Initialize rackaware ensemble placement policy @ @ : {}.", new Object[] { localNode, null == localNode ? "Unknown" : localNode.getNetworkLocation(), dnsResolver.getClass().getName() }); this.isWeighted = isWeighted; if (this.isWeighted) { this.maxWeightMultiple = maxWeightMultiple; this.weightedSelection = new WeightedRandomSelection<BookieNode>(this.maxWeightMultiple); LOG.info("Weight based placement with max multiple of " + this.maxWeightMultiple); } else { LOG.info("Not weighted"); } return this; }

Target:
protected RackawareEnsemblePlacementPolicyImpl initialize(DNSToSwitchMapping dnsResolver, HashedWheelTimer timer, boolean reorderReadsRandom, int stabilizePeriodSeconds, boolean isWeighted, int maxWeightMultiple, StatsLogger statsLogger) { Preconditions.checkNotNull(statsLogger, "statsLogger should not be null, use NullStatsLogger instead."); this.statsLogger = statsLogger; this.bookiesJoinedCounter = statsLogger.getOpStatsLogger(BookKeeperServerStats.BOOKIES_JOINED); this.bookiesLeftCounter = statsLogger.getOpStatsLogger(BookKeeperServerStats.BOOKIES_LEFT); this.reorderReadsRandom = reorderReadsRandom; this.stabilizePeriodSeconds = stabilizePeriodSeconds; this.dnsResolver = new DNSResolverDecorator(dnsResolver, () -> this.getDefaultRack()); this.timer = timer; if (stabilizePeriodSeconds > 0) { this.topology = new StabilizeNetworkTopology(timer, stabilizePeriodSeconds); } else { this.topology = new NetworkTopologyImpl(); } BookieNode bn; try { bn = createBookieNode(new BookieSocketAddress(InetAddress.getLocalHost().getHostAddress(), 0)); } catch (UnknownHostException e) { LOG.error("Failed to get local host address : ", e); bn = null; } localNode = bn; LOG.info("Initialize rackaware ensemble placement policy @ @ : {}.", new Object[] { localNode, null == localNode ? "Unknown" : localNode.getNetworkLocation(), dnsResolver.getClass().getName() }); this.isWeighted = isWeighted; if (this.isWeighted) { this.maxWeightMultiple = maxWeightMultiple; this.weightedSelection = new WeightedRandomSelection<BookieNode>(this.maxWeightMultiple); LOG.info("Weight based placement with max multiple of " + this.maxWeightMultiple); } else { LOG.info("Not weighted"); } return this; }