feat: pre-release code consistency, docs polish, and test optimizations for v2.0.0 - #123
Merged
Merged
Conversation
… and resolve SonarCloud reliability issues
…erializer and remove redundant Utils json/file-lock methods
… for LeaseFileLockingService - Replace directory move-and-rollback with atomic sibling mutex (<UploadId>.mutex/) and in-place expired lock takeover - Introduce LeaseFileMutex supporting try-with-resources, constructor-level auto-acquisition, isAcquired(), and 5s crash recovery - Extract doesLockOwnershipMatch helper in LeaseFileUploadLock and S3UploadLock for fencing on release and renewal - Add unit and stress tests for LeaseFileMutex and concurrent eviction contention - Update documentation in DISK_BASED_LOCKING.md, LOCKING.md, and CHANGELOG.md
… helper - Add Utils.createTempSiblingPath, Utils.atomicMove, and AutoCloseable Utils.TempPath - Centralize atomic serialization with temporary file rename in LeaseDataJsonSerializer, UploadInfoJsonSerializer, and Utils.writeSerializable - Add Utils.deletePathQuietly and replace redundant deleteIfExists try-catch blocks across all disk-based services - Add unit tests in UtilsTest, LeaseDataJsonSerializerTest, and UploadInfoJsonSerializerTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses pre-release polish items identified during final review of version 2.0.0, resolves SonarCloud reliability issues, unifies the distributed lease locking architecture, and harmonizes JSON serialization across all domain objects.
1. Unified Serialization Architecture
UploadInfoJsonSerializerwithLeaseDataJsonSerializer: Added complete suite of serializers and deserializers (String,byte[],OutputStream,File,Path, and typed/generic variants) toUploadInfoJsonSerializer.Utils.writeJsonandUtils.readJson.DiskStorageServicenow delegates serialization directly toUploadInfoJsonSerializer.FileLockattempts fromUtils.readSerializableandUtils.writeSerializable(using standardFiles.newInputStream/Files.newOutputStream), adhering todocs/DISK_BASED_LOCKING.mdand preventingENOLCKon shared network storage and unprivileged containers.2. Distributed Lease Locking Architecture & SonarCloud Reliability Fixes
LeaseDataDTO: Separated the serializable lease data model (LeaseData) from active lock lifecycle handles (LeaseFileUploadLock,S3UploadLock), adhering strictly to the Single Responsibility Principle.LeaseDataJsonSerializer: Centralized JSON serialization/deserialization across both disk-based locking (LeaseFileLockingService) and S3 distributed locking (S3LockingService), eliminatingS3UploadLockJsonSerializer.LeaseData, completely resolving partially initialized object warnings and potentialNullPointerExceptions.lockPathandstopPathproperties across disk and S3 backends, with ownership verification ensuringlockPathintegrity.tryAcquireLock(UploadId, LeaseData)inAbstractLeaseLockingService.Utils.javafor serializable and JSON file path operations.3. Code Consistency & Fixes
TusFileUploadServiceno-arg constructor to instantiateLeaseFileLockingService(idFactory, storagePath), aligning withwithStoragePath(String)to ensure container- and NFS-safe locking by default.isJsonSerializationEnabled()to returntrueon bothS3StorageServiceandAzureBlobStorageService.TusFileUploadServicedocumenting dual-protocol support for both Tus 1.0.0 and IETF Resumable Uploads for HTTP (RUFH).HttpProblemDetails#writeTo(TusServletResponse)to directly delegate towriteTo((HttpServletResponse) response).4. Documentation Accuracy
README.md: Updated Maven dependency snippet to2.0.0, corrected protocol enum reference toProtocolVersion.RUFH, and updated test suite class names.docs/TESTING.md: Updated version to2.0.0and retry count to 40 retries (8.0s budget).docs/S3_STORAGE.md: Synced test summary table withLeaseDataJsonSerializerTest.docs/LOCKING.md: Updated theUploadLockingServicesnippet to reflect actual interface signatures.docs/MIGRATION.md: Fixed inline comment referencingRUFH.docs/RELEASE.md: Cleaned up Section 6 numbering and streamlined instructions for Sonatype Central Portal Publishing.5. Verification
BUILD SUCCESS).