public void updateBlacklist(List<String> blacklistAdditions, List<String> blacklistRemovals) { try { writeLock.lock(); if (!isStopped) { if (isWaitingForAMContainer()) { // The request is for the AM-container, and the AM-container is // launched by the system. So, update the places that are blacklisted // by system (as opposed to those blacklisted by the application). this.appSchedulingInfo.updatePlacesBlacklistedBySystem( blacklistAdditions, blacklistRemovals); } else{ this.appSchedulingInfo.updatePlacesBlacklistedByApp( blacklistAdditions, blacklistRemovals); } } } finally { writeLock.unlock(); } }
new HashMap<String, String>(), null); appSchedulingInfo.updatePlacesBlacklistedByApp(new ArrayList<String>(), new ArrayList<String>()); Assert.assertFalse(appSchedulingInfo.getAndResetBlacklistChanged()); blacklistAdditions.add("node1"); blacklistAdditions.add("node2"); appSchedulingInfo.updatePlacesBlacklistedByApp(blacklistAdditions, new ArrayList<String>()); Assert.assertTrue(appSchedulingInfo.getAndResetBlacklistChanged()); appSchedulingInfo.updatePlacesBlacklistedByApp(blacklistAdditions, new ArrayList<String>()); Assert.assertFalse(appSchedulingInfo.getAndResetBlacklistChanged()); appSchedulingInfo.updatePlacesBlacklistedByApp(new ArrayList<String>(), blacklistRemovals); appSchedulingInfo.updatePlacesBlacklistedByApp(new ArrayList<String>(), blacklistRemovals); Assert.assertTrue(appSchedulingInfo.getAndResetBlacklistChanged()); appSchedulingInfo.updatePlacesBlacklistedByApp(new ArrayList<String>(), blacklistRemovals); Assert.assertFalse(appSchedulingInfo.getAndResetBlacklistChanged());