/** * Register the session in cache in order to clean the session folders in case of user * disconnection during an upload. * * @param uploadSession */ @SuppressWarnings("unchecked") private static void removeSessionFromCache(UploadSession uploadSession) { Set<String> sessionIds = CacheServiceProvider.getSessionCacheService().get(SESSION_CACHE_KEY, Set.class); if (sessionIds != null) { sessionIds.remove(uploadSession.getId()); CacheServiceProvider.getSessionCacheService() .remove(UPLOAD_SESSION_CACHE_KEY_PREFIX + uploadSession.getId()); } }
/** * Register the session in cache in order to clean the session folders in case of user * disconnection during an upload. * * @param uploadSession */ @SuppressWarnings("unchecked") private static void registerSessionInCache(UploadSession uploadSession) { Set<String> sessionIds = CacheServiceProvider.getSessionCacheService().get(SESSION_CACHE_KEY, Set.class); if (sessionIds == null) { sessionIds = new HashSet<String>(); CacheServiceProvider.getSessionCacheService().put(SESSION_CACHE_KEY, sessionIds); } sessionIds.add(uploadSession.uploadSessionId); CacheServiceProvider.getSessionCacheService() .put(UPLOAD_SESSION_CACHE_KEY_PREFIX + uploadSession.getId(), uploadSession); }