Skip to content

Conversation

@rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Dec 10, 2025

Wanted to move this into a separate class so it's easier / cleaner to prototype an incremental check listener. Also made BatchWriteSet nicer by making a bunch of fields final. No change in functionality, just cleaning up code.

Copilot AI review requested due to automatic review settings December 10, 2025 16:22
@rjrudin rjrudin requested a review from stevebio as a code owner December 10, 2025 16:22
@github-actions
Copy link

github-actions bot commented Dec 10, 2025

Copyright Validation Results
Total: 3 | Passed: 3 | Failed: 0 | Skipped: 0 | at: 2025-12-10 16:45:23 UTC | commit: 5bf5f48

✅ Valid Files

  • marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/BatchWriteSet.java
  • marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/BatchWriter.java
  • marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/WriteBatcherImpl.java

✅ All files have valid copyright headers!

Copy link

Copilot AI left a 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 refactors the BatchWriter class by extracting it from WriteBatcherImpl into its own file and improves the immutability of BatchWriteSet by making several fields final. The changes streamline the code structure without altering functionality.

Key changes:

  • Extracted BatchWriter inner class to a separate top-level class
  • Made multiple fields in BatchWriteSet final and removed their setters
  • Updated BatchWriteSet constructor to accept batchNumber parameter directly

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
WriteBatcherImpl.java Removed BatchWriter inner class and updated references to use getter method; updated BatchWriteSet instantiation to pass batchNumber in constructor
BatchWriter.java New file containing extracted BatchWriter class with package-private visibility and added getter for writeSet
BatchWriteSet.java Made fields final, removed setters, updated constructor to accept batchNumber, removed unused onBeforeWrite functionality, and changed class to package-private

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Override
public void run() {
try {
logger.trace("begin write batch {} to forest on host \"{}\"", writeSet.getBatchNumber(), writeSet.getClient().getHost());
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onBeforeWrite callback that was present in the original implementation has been removed. If this callback was being used elsewhere in the codebase, its removal could break existing functionality. Verify that onBeforeWrite was truly unused before removing this feature.

Suggested change
logger.trace("begin write batch {} to forest on host \"{}\"", writeSet.getBatchNumber(), writeSet.getClient().getHost());
logger.trace("begin write batch {} to forest on host \"{}\"", writeSet.getBatchNumber(), writeSet.getClient().getHost());
Runnable onBeforeWrite = writeSet.getOnBeforeWrite();
if (onBeforeWrite != null) {
onBeforeWrite.run();
}

Copilot uses AI. Check for mistakes.
this.client = client;
this.transform = transform;
this.temporalCollection = temporalCollection;
this.batchNumber = batchNumber;
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: this line uses tabs while most other lines in the constructor use spaces. Standardize to match the project's indentation style.

Suggested change
this.batchNumber = batchNumber;
this.batchNumber = batchNumber;

Copilot uses AI. Check for mistakes.
@rjrudin rjrudin force-pushed the feature/batch-listener branch 2 times, most recently from 6678ff7 to ed87416 Compare December 10, 2025 16:43
Wanted to move this into a separate class so it's easier / cleaner to prototype an incremental check listener. Also made BatchWriteSet nicer by making a bunch of fields final. No change in functionality, just cleaning up code.
@rjrudin rjrudin force-pushed the feature/batch-listener branch from ed87416 to 5bf5f48 Compare December 10, 2025 16:44
@rjrudin rjrudin merged commit a035b8e into develop Dec 10, 2025
3 checks passed
@rjrudin rjrudin deleted the feature/batch-listener branch December 10, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants