@Override
    public Collection<String> getSharedGroupNames(JID user) {
        user = user.asBareJID();
        HashSet<String> groupNames;
        synchronized (sharedGroupMetaCache) {
            groupNames = getSharedGroupsForUserFromCache(user.getNode());
            if (groupNames == null) {
                groupNames = new HashSet<>();

                if (!hasSharedGroups()) {
                    // When there are no shared groups in the database at all, don't bother looking up specific ones.
                    return groupNames;
                }

                if (!getSharedGroupNames().isEmpty()) {
                    for (String userGroup : getGroupNames(user)) {
                        groupNames.addAll(getVisibleGroupNames(userGroup));
                    }
                    groupNames.addAll(getPublicSharedGroupNames());
                }
                saveSharedGroupsForUserInCache(user.getNode(), groupNames);
            }
        }

        return groupNames;
    }
Checks if any shared groups exists. No distinction is made between the type of shared group: any group that is
shared (with anything other than 'nobody') qualifies.

@return true if at least one shared group exists, otherwise false.
xmppserver/src/main/java/org/jivesoftware/openfire/group/AbstractGroupProvider.java