Skip to content

feat(gax): add progress listener models and UploadProgressTracker - #14426

Draft
whowes wants to merge 1 commit into
whowes/resumable-upload-watchdogfrom
whowes/resumable-upload-progress-model
Draft

whowes wants to merge 1 commit into
whowes/resumable-upload-watchdogfrom
whowes/resumable-upload-progress-model

Conversation

@whowes

@whowes whowes commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Introduces ResumableUploadStatus, UploadProgressListener, and thread-safe UploadProgressTracker. Tracks uploaded byte counts and state transitions across chunk attempts.

@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 66b6815 to fd6016a Compare September 17, 2026 22:08

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a thread-safe progress tracking mechanism for resumable uploads, consisting of the ResumableUploadProgressListener interface, the ResumableUploadStatus value class, and the UploadProgressTracker coordinator, along with comprehensive unit tests. Feedback on the changes suggests clearing the registered listeners list in UploadProgressTracker once a terminal state is reached to prevent potential memory leaks.

Comment on lines +219 to +226
@GuardedBy("lock")
private List<RegisteredListener> updateStatusLocked(ResumableUploadStatus newStatus) {
this.currentStatus = newStatus;
if (newStatus.getUploadUrl() != null && this.uploadSessionUrl == null) {
this.uploadSessionUrl = newStatus.getUploadUrl();
}
return new ArrayList<>(this.listeners);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To prevent potential memory leaks and unnecessary resource retention, the list of registered listeners should be cleared once the tracker enters a terminal state (FINALIZED or FAILED). Since no further progress updates can occur after reaching a terminal state, holding onto the listeners (and potentially their enclosing classes or executors) is unnecessary.

  @GuardedBy("lock")
  private List<RegisteredListener> updateStatusLocked(ResumableUploadStatus newStatus) {
    this.currentStatus = newStatus;
    if (newStatus.getUploadUrl() != null && this.uploadSessionUrl == null) {
      this.uploadSessionUrl = newStatus.getUploadUrl();
    }
    List<RegisteredListener> snapshot = new ArrayList<>(this.listeners);
    if (newStatus.isTerminal()) {
      this.listeners.clear();
    }
    return snapshot;
  }

@whowes
whowes added this pull request to stack #14429 September 17, 2026 22:16
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from fd6016a to 18db19d Compare September 17, 2026 22:22
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 18db19d to b44760b Compare September 18, 2026 02:23
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from b44760b to 25bba5f Compare September 18, 2026 03:01
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 25bba5f to bafa84d Compare September 18, 2026 03:21
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from bafa84d to 7b55d31 Compare September 18, 2026 15:05
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 7b55d31 to 5f66ff4 Compare September 19, 2026 01:37
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
76.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

1 participant