/**
  * Clears the upload sessions still attached to a user session.
  *
  * @param sessionInfo the session of a user.
  */
 @SuppressWarnings("unchecked")
 public static void clearFrom(SessionInfo sessionInfo) {
   Set<String> sessionIds = sessionInfo.getCache().get(SESSION_CACHE_KEY, Set.class);
   if (sessionIds != null) {
     for (String uploadSessionId : new ArrayList<String>(sessionIds)) {
       try {
         UploadSession.from(uploadSessionId).clear();
       } catch (Exception ignore) {
       }
     }
     sessionInfo.getCache().remove(SESSION_CACHE_KEY);
   }
 }
 /**
  * Clears the volatile cache attached to a user session.
  *
  * @param sessionInfo the session of a user.
  */
 public static void clearFrom(SessionInfo sessionInfo) {
   VolatileResourceCacheService cache =
       sessionInfo
           .getCache()
           .get(VolatileResourceCacheService.class.getName(), VolatileResourceCacheService.class);
   if (cache != null) {
     cache.clear();
   }
 }