log.debug("Removing group and associated objects for groupid:" + groupId);
startTime = endTime;
}
// Remove the group itself and adjust parent org stats recursively
DeleteGroupResponse deleteGroupResponse = deleteGroupDAO.execute(groupId);
if (log.isDebugEnabled())
{
endTime = System.currentTimeMillis();
log.debug("Time to remove group and associated objects: " + (endTime - startTime));
}
Long endDB = null;
if (log.isInfoEnabled())
{
endDB = System.currentTimeMillis();
}
// ================= Cache update task generation =======================
Long startAsync = null;
if (log.isInfoEnabled())
{
startAsync = System.currentTimeMillis();
}
int startSize = 0;
int endSize = 0;
if (log.isDebugEnabled())
{
startSize = inActionContext.getUserActionRequests().size();
}
// purge fixed set of cache keys.
generateSingleDeleteKeyFromCacheTask(getKeysToPurgeFromCache(deleteGroupResponse), inActionContext);
if (log.isDebugEnabled())
{
endSize = inActionContext.getUserActionRequests().size();
log.debug("Tasks for purge fixed set of cache keys: " + (endSize - startSize));
}
startSize = endSize;
// create tasks (1/key) for removing group id from CacheKeys.GROUPS_FOLLOWED_BY_PERSON lists
generateRemoveIdsFromListTasks(createKeys(CacheKeys.GROUPS_FOLLOWED_BY_PERSON, followerIds), Collections
.singletonList(deleteGroupResponse.getGroupId()), inActionContext);
if (log.isDebugEnabled())
{
endSize = inActionContext.getUserActionRequests().size();
log.debug("Tasks for remove group id from GROUPS_FOLLOWED_BY_PERSON lists: " + (endSize - startSize));
}
startSize = endSize;
// create task for removing activities in group's stream from users' starred activity lists.
generateRemoveIdsFromStarredActivityListTasks(deleteActivityResponse, inActionContext);
if (log.isDebugEnabled())
{
endSize = inActionContext.getUserActionRequests().size();
log.debug("Tasks for remove groups activity ids from starred activity lists: " + (endSize - startSize));
}
// get list of activity ids to remove from cache lists, no need to go beyond maxCacheListSize
List<Long> cachedActivityIds = deleteActivityResponse.getActivityIds().size() > maxCacheListSize // \n
? deleteActivityResponse.getActivityIds().subList(0, maxCacheListSize - 1)
: deleteActivityResponse.getActivityIds();
startSize = endSize;
if (log.isDebugEnabled())
{
endSize = inActionContext.getUserActionRequests().size();
log.debug("Tasks for remove activity ids from parent orgs of the deleted group: " + (endSize - startSize));
}
// create task for removing activities in group's stream from everyone stream
generateRemoveIdsFromListTasks(Collections.singletonList(CacheKeys.EVERYONE_ACTIVITY_IDS), cachedActivityIds,
inActionContext);
startSize = endSize;
// purge group from search index.
generateDeleteFromSearchIndexTasks(DomainGroup.class, Collections.singletonList(deleteGroupResponse
.getGroupId()), inActionContext);
if (log.isDebugEnabled())
{
endSize = inActionContext.getUserActionRequests().size();