public void registerIncomingServerSession(String domain, LocalIncomingServerSession session) {
        // Keep local track of the incoming server session connected to this JVM
        StreamID streamID = session.getStreamID();

        Lock lock = incomingServerSessionInfoCache.getLock(streamID);
        lock.lock();
        try {
            // Add this instance (possibly replacing an older version, if the session already existed but now has an additional validated domain).
            localSessionManager.addIncomingServerSessions(streamID, session);
            incomingServerSessionInfoCache.put(streamID, new IncomingServerSessionInfo(session));
        } finally {
            lock.unlock();
        }

        // Update list of sockets/sessions coming from the same remote domain
        CacheUtil.addValueToMultiValuedCache(domainSessionsCache, domain, streamID, ArrayList::new);
    }
Registers that a server session originated by a remote server is hosting a given domain.
Notice that the remote server may be hosting several subdomains as well as virtual hosts so
the same IncomingServerSession may be associated with many domains. If the remote server
creates many sessions to this server (eg. one for each subdomain) then associate all
the sessions with the originating server that created all the sessions.

@param domain the domain that is being served by the remote server.
@param session the incoming server session to the remote server.
xmppserver/src/main/java/org/jivesoftware/openfire/SessionManager.java