Class RecordLockManager
java.lang.Object
io.goobi.viewer.model.security.recordlock.RecordLockManager
Manages concurrent view limits and access condition caches for individual records.
Tracks active record locks per session and caches Solr-derived access conditions to avoid redundant queries.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidlockRecord(String pi, String sessionId, Integer limit) booleanremoveLockForPiAndSessionId(String pi, String sessionId) intremoveLocksForSessionId(String sessionId, List<String> skipPiList) intremoveOldLocks(long maxAge) Removes all record locks that are older thatmaxAgemilliseconds.
-
Constructor Details
-
RecordLockManager
public RecordLockManager()
-
-
Method Details
-
lockRecord
- Parameters:
pi- Record identifiersessionId- HTTP session IDlimit- Optional number of concurrent views for the record- Returns:
- a
LockRecordResult, indicating that either a lock has been set, the lock limit was exceeded or that no action was necessary - Throws:
IllegalArgumentException- if the given pi is null
-
removeLocksForSessionId
- Parameters:
sessionId- HTTP session IDskipPiList- Optional list of identifiers to skip- Returns:
- number of records if session id removed successfully
-
removeLockForPiAndSessionId
- Parameters:
pi- persistent identifier of the locked recordsessionId- HTTP session ID holding the lock- Returns:
- true if lock removed successfully; false otherwise
-
removeOldLocks
public int removeOldLocks(long maxAge) Removes all record locks that are older thatmaxAgemilliseconds. Can be used to periodically clean up locks that might have been missed by the web socket mechanism.- Parameters:
maxAge- maximum age of locks in milliseconds before removal- Returns:
- Number of removed locks
-
emptyCacheForRecord
- Parameters:
pi- persistent identifier of the record to clear from cache
-
getRecordAccessConditionsCache
-
getRecordLimitsCache
-