public class DiskLockingService extends AbstractDiskBasedService implements UploadLockingService
UploadLockingService implementation that uses the file system for implementing locking
| Constructor and Description |
|---|
DiskLockingService(String storagePath) |
DiskLockingService(UploadIdFactory idFactory,
String storagePath) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupStaleLocks()
Clean up any stale locks that are still present
|
boolean |
isLocked(UploadId id)
Check if the upload with the given ID is currently locked
|
UploadLock |
lockUploadByUri(String requestURI)
If the given URI represents a valid upload, lock that upload for processing
|
void |
setIdFactory(UploadIdFactory idFactory)
Set an instance if IdFactory to be used for creating identities and extracting them from uploadURIs
|
getPathInStorageDirectory, getStoragePathpublic DiskLockingService(String storagePath)
public DiskLockingService(UploadIdFactory idFactory, String storagePath)
public UploadLock lockUploadByUri(String requestURI) throws TusException, IOException
UploadLockingServicelockUploadByUri in interface UploadLockingServicerequestURI - The URI that potentially represents an uploadTusException - If the upload is already lockedIOExceptionpublic void cleanupStaleLocks()
throws IOException
UploadLockingServicecleanupStaleLocks in interface UploadLockingServiceIOException - When cleaning a stale lock failspublic boolean isLocked(UploadId id)
UploadLockingServiceisLocked in interface UploadLockingServiceid - The ID of the upload to checkpublic void setIdFactory(UploadIdFactory idFactory)
UploadLockingServicesetIdFactory in interface UploadLockingServiceidFactory - The UploadIdFactory to use within this locking serviceCopyright © 2023. All rights reserved.