public Group getGroup(String name, boolean forceLookup) throws GroupNotFoundException {

        final CacheableOptional<Group> firstCachedGroup;
        if (forceLookup) {
            firstCachedGroup = null;
            groupCache.remove(name);
        } else {
            firstCachedGroup = groupCache.get(name);
        }

        if (firstCachedGroup != null) {
            return toGroup(name, firstCachedGroup);
        }

        final Lock lock = groupCache.getLock(name);
        lock.lock();
        try {
            final CacheableOptional<Group> secondCachedGroup = groupCache.get(name);
            if (secondCachedGroup != null) {
                return toGroup(name, secondCachedGroup);
            }

            try {
                final Group group = provider.getGroup(name);
                groupCache.put(name, CacheableOptional.of(group));
                return group;
            } catch (final GroupNotFoundException e) {
                groupCache.put(name, CacheableOptional.of(null));
                throw e;
            }
        } finally {
            lock.unlock();
        }
    }
Returns a Group by name.

@param name The name of the group to retrieve
@param forceLookup Invalidate the group cache for this group
@return The group corresponding to that name
@throws GroupNotFoundException if the group does not exist.
xmppserver/src/main/java/org/jivesoftware/openfire/group/GroupManager.java