Source:
public List<BookieSocketAddress> newEnsemble(int ensembleSize, int writeQuorumSize, int ackQuorumSize, Map<String, byte[]> customMetadata) throws BKNotEnoughBookiesException { long startTime = MathUtils.nowInNano(); Pair<List<BookieSocketAddress>, Boolean> newEnsembleResponse; List<BookieSocketAddress> socketAddresses; boolean isEnsembleAdheringToPlacementPolicy = false; try { newEnsembleResponse = placementPolicy.newEnsemble(ensembleSize, writeQuorumSize, ackQuorumSize, customMetadata, new HashSet<BookieSocketAddress>( quarantinedBookies.asMap().keySet())); socketAddresses = newEnsembleResponse.getLeft(); isEnsembleAdheringToPlacementPolicy = newEnsembleResponse.getRight(); if (!isEnsembleAdheringToPlacementPolicy) { newEnsembleNotAdheringToPlacementPolicy.inc(); log.warn("New ensemble: is not adhering to Placement Policy", socketAddresses); } newEnsembleTimer.registerSuccessfulEvent(MathUtils.nowInNano() - startTime, TimeUnit.NANOSECONDS); } catch (BKNotEnoughBookiesException e) { if (log.isDebugEnabled()) { log.debug("Not enough healthy bookies available, using quarantined bookies"); } newEnsembleResponse = placementPolicy.newEnsemble( ensembleSize, writeQuorumSize, ackQuorumSize, customMetadata, new HashSet<>()); socketAddresses = newEnsembleResponse.getLeft(); isEnsembleAdheringToPlacementPolicy = newEnsembleResponse.getRight(); if (!isEnsembleAdheringToPlacementPolicy) { newEnsembleNotAdheringToPlacementPolicy.inc(); log.warn("New ensemble: is not adhering to Placement Policy", socketAddresses); } newEnsembleTimer.registerFailedEvent(MathUtils.nowInNano() - startTime, TimeUnit.NANOSECONDS); } return socketAddresses; }

Target:
public List<BookieSocketAddress> newEnsemble(int ensembleSize, int writeQuorumSize, int ackQuorumSize, Map<String, byte[]> customMetadata) throws BKNotEnoughBookiesException { long startTime = MathUtils.nowInNano(); Pair<List<BookieSocketAddress>, Boolean> newEnsembleResponse; List<BookieSocketAddress> socketAddresses; boolean isEnsembleAdheringToPlacementPolicy = false; try { Set<BookieSocketAddress> quarantinedBookiesSet = quarantinedBookies.asMap().keySet(); newEnsembleResponse = placementPolicy.newEnsemble(ensembleSize, writeQuorumSize, ackQuorumSize, customMetadata, new HashSet<BookieSocketAddress>(quarantinedBookiesSet)); socketAddresses = newEnsembleResponse.getLeft(); isEnsembleAdheringToPlacementPolicy = newEnsembleResponse.getRight(); if (!isEnsembleAdheringToPlacementPolicy) { ensembleNotAdheringToPlacementPolicy.inc(); log.warn("New ensemble: is not adhering to Placement Policy. quarantinedBookies: {}", socketAddresses, quarantinedBookiesSet); } newEnsembleTimer.registerSuccessfulEvent(MathUtils.nowInNano() - startTime, TimeUnit.NANOSECONDS); } catch (BKNotEnoughBookiesException e) { if (log.isDebugEnabled()) { log.debug("Not enough healthy bookies available, using quarantined bookies"); } newEnsembleResponse = placementPolicy.newEnsemble( ensembleSize, writeQuorumSize, ackQuorumSize, customMetadata, new HashSet<>()); socketAddresses = newEnsembleResponse.getLeft(); isEnsembleAdheringToPlacementPolicy = newEnsembleResponse.getRight(); if (!isEnsembleAdheringToPlacementPolicy) { ensembleNotAdheringToPlacementPolicy.inc(); log.warn("New ensemble: is not adhering to Placement Policy", socketAddresses); } newEnsembleTimer.registerFailedEvent(MathUtils.nowInNano() - startTime, TimeUnit.NANOSECONDS); } return socketAddresses; }