Package de.unirostock.sems.cbarchive.web
Class QuotaManager
- java.lang.Object
-
- de.unirostock.sems.cbarchive.web.QuotaManager
-
public class QuotaManager extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classQuotaManager.Worker
-
Field Summary
Fields Modifier and Type Field Description protected StatisticDatastatsprotected DatestatsTimestampprotected longtotalSizeprotected longworkerExecutionTimeprotected ThreadworkerThreadprotected Map<String,Long>workspaceCacheprotected WorkspaceManagerworkspaceManager
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforceAsyncScan(boolean storeSettingsAfterwards)Starts an async scan of all workspaces, also deletes workspaces which are too oldstatic QuotaManagergetInstance()Returns the Singleton instanceStatisticDatagetStats()Gets the statistics on the page.longgetTotalSize()Retuns the total size in bytes from all workspaces or 0L if it fails.StatisticDatagetUserStats(UserManager user)Gets the user stats.longgetWorkspaceSize(Workspace workspace)Returns the size in bytes of all archives together in the workspace or0Lif it fails.longupdateWorkspace(Workspace workspace)Updates the size of the workspacelongupdateWorkspace(String workspaceId)Updates the size of the workspace or removes the result from the cache, if the workspace is not available anymore
-
-
-
Field Detail
-
workspaceManager
protected WorkspaceManager workspaceManager
-
totalSize
protected long totalSize
-
workerThread
protected Thread workerThread
-
workerExecutionTime
protected long workerExecutionTime
-
stats
protected StatisticData stats
-
statsTimestamp
protected Date statsTimestamp
-
-
Method Detail
-
getInstance
public static QuotaManager getInstance()
Returns the Singleton instance- Returns:
- the QuotaManager
-
getTotalSize
public long getTotalSize()
Retuns the total size in bytes from all workspaces or 0L if it fails.- Returns:
- the total size
-
forceAsyncScan
public void forceAsyncScan(boolean storeSettingsAfterwards)
Starts an async scan of all workspaces, also deletes workspaces which are too old- Parameters:
storeSettingsAfterwards- if set to true, the main properties will be stored after the scan
-
getWorkspaceSize
public long getWorkspaceSize(Workspace workspace)
Returns the size in bytes of all archives together in the workspace or0Lif it fails.- Parameters:
workspace- the workspace- Returns:
- the size in bytes of all archives in the workspace
-
updateWorkspace
public long updateWorkspace(String workspaceId)
Updates the size of the workspace or removes the result from the cache, if the workspace is not available anymore- Parameters:
workspaceId- id of the workspace- Returns:
- the new size of the workspace
-
getStats
public StatisticData getStats()
Gets the statistics on the page.- Returns:
- the stats
-
getUserStats
public StatisticData getUserStats(UserManager user)
Gets the user stats.- Parameters:
user- the user- Returns:
- the user stats
-
updateWorkspace
public long updateWorkspace(Workspace workspace)
Updates the size of the workspace- Parameters:
workspace- the workspace- Returns:
- updated size of the workspace
-
-