@Override
    public Collection<String> getPublicSharedGroupNames() {
        HashSet<String> groupNames;
        synchronized (sharedGroupMetaCache) {
            groupNames = getPublicGroupsFromCache();
            if (groupNames != null) {
                return groupNames;
            }

            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;
            }

            Connection con = null;
            PreparedStatement pstmt = null;
            ResultSet rs = null;
            try {
                con = DbConnectionManager.getConnection();
                pstmt = con.prepareStatement(PUBLIC_GROUPS_SQL);
                rs = pstmt.executeQuery();
                while (rs.next()) {
                    groupNames.add(rs.getString(1));
                }
                savePublicGroupsInCache(groupNames);
            } catch (SQLException sqle) {
                Log.error(sqle.getMessage(), sqle);
            } finally {
                DbConnectionManager.closeConnection(rs, pstmt, con);
            }
            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