public boolean hasSharedGroups() {
        Boolean result;
        synchronized (sharedGroupMetaCache) {
            result = getHasSharedGroupsFromCache();
            if (result != null) {
                return result;
            }

            Connection con = null;
            PreparedStatement pstmt = null;
            ResultSet rs = null;
            try {
                con = DbConnectionManager.getConnection();
                if (DbConnectionManager.getDatabaseType() == DbConnectionManager.DatabaseType.oracle) {
                    pstmt = con.prepareStatement("SELECT 1 FROM dual " + HAS_SHARED_GROUPS_PARTIAL);
                } else {
                    pstmt = con.prepareStatement("SELECT 1 FROM ofGroupProp " + HAS_SHARED_GROUPS_PARTIAL);
                }
                rs = pstmt.executeQuery();
                result = rs.next();
                saveHasSharedGroupsInCache(result);
                if (!result) {
                    saveSharedGroupsInCache(new HashSet<>());
                }
                return result;
            } catch (SQLException sqle) {
                Log.error(sqle.getMessage(), sqle);
                return true; // If the query above fails, lets not skip shared group lookups.
            } finally {
                DbConnectionManager.closeConnection(rs, pstmt, con);
            }
        }
    }
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