public synchronized void update(ApplicationId key, Collection<String> newHosts) {
        verifyHosts(key, newHosts);
        Collection<String> currentHosts = getHosts(key);
        log.log(Level.FINE, () -> "Setting hosts for key '" + key + "', " +
                                  "newHosts: " + newHosts + ", " +
                                  "currentHosts: " + currentHosts);
        Collection<String> removedHosts = findRemovedHosts(newHosts, currentHosts);
        removeHosts(removedHosts);
        addHosts(key, newHosts);
    }
@Test(expected = IllegalArgumentException.class)
    public void keys_cannot_overlap() {
        HostRegistry reg = new HostRegistry();
        reg.update(foo, List.of("foo.com", "bar.com"));
        reg.update(bar, List.of("bar.com", "baz.com"));
    }