-
Notifications
You must be signed in to change notification settings - Fork 74
MLE-26420 Some refactoring of WriteBatcher before incremental write PR #1864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Copyright Validation Results ⏭️ Skipped (Excluded) Files
✅ Valid Files
✅ All files have valid copyright headers! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR performs refactoring work on the WriteBatcher implementation to prepare for upcoming incremental write functionality. The changes focus on code cleanup, modernizing Java syntax, and improving code organization without altering core functionality.
Key Changes:
- Converted BatchWriter from a class to a Java record for cleaner immutability
- Modernized code style by simplifying boolean comparisons and using pattern matching
- Consolidated import statements for better organization
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/WriteBatcherImpl.java | Simplified boolean comparisons, consolidated imports, removed unused message parameter from error handling |
| marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/BatchWriter.java | Converted class to record, refactored run() method into smaller methods, used pattern matching for instanceof checks |
| marklogic-client-api/src/main/java/com/marklogic/client/datamovement/WriteBatcher.java | Removed commented-out code, cleaned up method modifiers, consolidated imports |
| marklogic-client-api/src/test/java/com/marklogic/client/test/AbstractClientTest.java | Added AfterEach hook to properly release client resources after tests |
| gradle.properties | Bumped version from 8.0-SNAPSHOT to 8.1-SNAPSHOT |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| class BatchWriter implements Runnable { | ||
| record BatchWriter(BatchWriteSet batchWriteSet) implements Runnable { | ||
|
|
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation check for empty batch has been removed during the conversion to a record. Previously, the constructor threw an IllegalStateException if 'batchWriteSet.getDocumentWriteSet().size() == 0'. This validation should be added to a compact constructor in the record to maintain the same safety guarantee.
| BatchWriter { | |
| if (batchWriteSet.getDocumentWriteSet().size() == 0) { | |
| throw new IllegalStateException("BatchWriter requires a non-empty DocumentWriteSet."); | |
| } | |
| } |
Just some cleanup here before new functionality is added. Fixing some warnings in WriteBatcherImpl, and changed BatchWriter into a record.
45237f1 to
f65fcf8
Compare
Just some cleanup here before new functionality is added. Fixing some warnings in WriteBatcherImpl, and changed BatchWriter into a record.