public void broadcastPresence(Presence packet) {
        final RoutingTable routingTable = XMPPServer.getInstance().getRoutingTable();

        if (routingTable == null) {
            return;
        }
        // Get the privacy list of this user
        PrivacyList list = null;
        JID from = packet.getFrom();
        if (from != null) {
            // Try to use the active list of the session. If none was found then try to use
            // the default privacy list of the session
            ClientSession session = SessionManager.getInstance().getSession(from);
            if (session != null) {
                list = session.getActiveList();
                list = list == null ? session.getDefaultList() : list;
            }
        }
        if (list == null) {
            // No privacy list was found (based on the session) so check if there is a default list
            list = PrivacyListManager.getInstance().getDefaultPrivacyList(username);
        }
        // Broadcast presence to subscribed entities
        for (RosterItem item : rosterItems.values()) {
            if (item.getSubStatus() == RosterItem.SUB_BOTH || item.getSubStatus() == RosterItem.SUB_FROM) {
                packet.setTo(item.getJid());
                if (list != null && list.shouldBlockPacket(packet)) {
                    // Outgoing presence notifications are blocked for this contact
                    continue;
                }
                JID searchNode = new JID(item.getJid().getNode(), item.getJid().getDomain(), null, true);
                final List<JID> routingTableRoutes = routingTable.getRoutes(searchNode, null);
                for (JID jid : routingTableRoutes) {
                    try {
                        routingTable.routePacket(jid, packet);
                    } catch (Exception e) {
                        // Theoretically only happens if session has been closed.
                        Log.debug(e.getMessage(), e);
                    }
                }
            }
        }
        // Broadcast presence to shared contacts whose subscription status is FROM
        final Set<String> implicitFroms = implicitFrom.keySet();
        for (String contact : implicitFroms) {
            if (contact.contains("@")) {
                String node = contact.substring(0, contact.lastIndexOf("@"));
                String domain = contact.substring(contact.lastIndexOf("@") + 1);
                node = JID.escapeNode(node);
                contact = new JID(node, domain, null).toBareJID();
            }

            packet.setTo(contact);
            if (list != null && list.shouldBlockPacket(packet)) {
                // Outgoing presence notifications are blocked for this contact
                continue;
            }

            final List<JID> routingTableRoutes = routingTable.getRoutes(new JID(contact), null);
            for (JID jid : routingTableRoutes) {
                try {
                    routingTable.routePacket(jid, packet);
                } catch (Exception e) {
                    // Theoretically only happens if session has been closed.
                    Log.debug(e.getMessage(), e);
                }
            }
        }
        if (from != null) {
            // Broadcast presence to all resources of the user.
            SessionManager.getInstance().broadcastPresenceToResources( from, packet);
        }
    }
<p>Broadcast the presence update to all subscribers of the roster.</p>
<p>Any presence change typically results in a broadcast to the roster members.</p>

@param packet The presence packet to broadcast
xmppserver/src/main/java/org/jivesoftware/openfire/roster/Roster.java