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
    public void multiple_keys_are_handled() {
        HostRegistry reg = new HostRegistry();
        reg.update(foo, List.of("foo.com", "bar.com"));
        reg.update(bar, List.of("baz.com", "quux.com"));
        assertGetKey(reg, "foo.com", foo);
        assertGetKey(reg, "bar.com", foo);
        assertGetKey(reg, "baz.com", bar);
        assertGetKey(reg, "quux.com", bar);
    }