class DefaultRightLoader extends AbstractLogEnabled implements RightLoader {

    @Override
    public AccessLevel load(DocumentReference user, EntityReference entity)
        throws RightServiceException
    {
        int retries = 0;
    RETRY: 
        while (true) {
            rightCacheInvalidator.suspend();

            try {
                retries++;
                return loadRequiredEntries(user, entity);
            } catch (ParentEntryEvictedException e) {
                if (retries < MAX_RETRIES) {
                    getLogger().debug("The parent entry was evicted. Have tried " 
                                      + retries
                                      + " times.  Trying again...");
                    continue RETRY;
                }
            } catch (ConflictingInsertionException e) {
                if (retries < MAX_RETRIES) {
                    getLogger().debug("There were conflicting insertions.  Have tried "
                                      + retries
                                      + " times.  Retrying...");
                    continue RETRY;
                }
            } finally {
                rightCacheInvalidator.resume();
            }
            getLogger().error("Failed to load the cache in "
                              + retries
                              + " attempts.  Giving up.");
            throw new RightServiceException();
        }
    }

}