private void addRecordForDomain(KeeperRecord record, String domain) {

        if (domain == null)
            return;

        KeeperRecord existing = cachedRecordsByDomain.putIfAbsent(domain, record);
        if (existing != null && record != existing)
            cachedAmbiguousDomains.add(domain);

    }
Associates the given record with the given domain. The domain may be
null. Both {@link #cachedRecordsByDomain} and {@link #cachedAmbiguousDomains}
are updated appropriately. The write lock of {@link #cacheLock} must
already be acquired before invoking this function.

@param record
    The record to associate with the domains in the given field.

@param domain
    The domain that the given record should be associated with.
    This may be null.
extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmClient.java