public void unregisterIncomingServerSession(@Nonnull final StreamID streamID)
    {
        Log.trace("Unregistering incoming server session for stream ID {}", streamID);

        final Set<String> domainsToRemove = new HashSet<>();
        final Lock lock = incomingServerSessionInfoCache.getLock(streamID);
        lock.lock();
        try {
            final LocalIncomingServerSession local = localSessionManager.removeIncomingServerSessions(streamID);;
            Log.trace("Found {} local incoming server session to remove for stream ID {}.", local == null ? "NO" : "a", streamID);
            if (local != null) {
                domainsToRemove.addAll(local.getValidatedDomains());
            }
            final IncomingServerSessionInfo cached = incomingServerSessionInfoCache.remove(streamID);
            Log.trace("Found {} cached server session info to remove for stream ID {}", local == null ? "NO" : "a", streamID);
            if (cached != null) {
                domainsToRemove.addAll(cached.getValidatedDomains());
            }
            Log.trace("Removing validated domain(s) for stream ID {}: {}", streamID, String.join(", ", domainsToRemove));
        } finally {
            lock.unlock();
        }

        // Update list of sockets/sessions coming from the same remote domain
        domainsToRemove.forEach(domain -> CacheUtil.removeValueFromMultiValuedCache(domainSessionsCache, domain, streamID));
    }
Unregisters a remote server session identified by a stream ID, and disassociates all associated domains.

@param streamID identifier for the session to unregister.
xmppserver/src/main/java/org/jivesoftware/openfire/SessionManager.java