/** * Load the user quota details * * @param userName - name of the user. * @return UserQuotaDetails * @throws QuotaManagerException */ private UserQuotaDetails loadUsageDetails(String userName) throws QuotaManagerException { // Check if the user name is available UserQuotaDetails quotaDetails = null; try { if (userName == null || userName.length() == 0) { logger.debug("user name is null or empty - throw QuotaManagerException"); throw new QuotaManagerException("No user name for client"); } // Get the usage quota and current usage values for the user long userQuota = m_usageService.getUserQuota(userName); long userUsage = m_usageService.getUserUsage(userName); // Create the user quota details for live tracking quotaDetails = new UserQuotaDetails(userName, userQuota); if (userUsage > 0L) { quotaDetails.setCurrentUsage(userUsage); } // Add the details to the live tracking table // Check if another thread has added the details UserQuotaDetails details = m_liveUsage.get(userName); if (details != null) { quotaDetails = details; } else { m_liveUsage.put(userName, quotaDetails); } // DEBUG if (logger.isDebugEnabled()) { logger.debug("Added live usage tracking " + quotaDetails); } } catch (Exception ex) { // Log the error if (logger.isDebugEnabled()) { logger.debug("Failed to load usage for" + userName, ex); } // Failed to load usage details throw new QuotaManagerException("Failed to load usage for " + userName + ", " + ex); } // Return the user usage details return quotaDetails; }