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-watchdog branch 2 times, most recently from 4dfdd22 to 3794533 Compare September 18, 2026 02:23
@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-watchdog branch from 3794533 to 497d777 Compare September 18, 2026 03:01
@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-watchdog branch from 497d777 to a5ffaf3 Compare September 18, 2026 03:21
@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-watchdog branch from a5ffaf3 to fc40846 Compare September 18, 2026 15:05
@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-watchdog branch from fc40846 to 6960f29 Compare September 19, 2026 01:36
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 7b55d31 to 5f66ff4 Compare September 19, 2026 01:37
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from 6960f29 to 7d98c7b Compare September 19, 2026 21:12
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 5f66ff4 to 6648aca Compare September 19, 2026 21:24
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from 7d98c7b to a355e4a Compare September 19, 2026 22:57
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 6648aca to e449f69 Compare September 19, 2026 22:58
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from a355e4a to c59321f Compare September 19, 2026 23:17
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from e449f69 to e65339b Compare September 19, 2026 23:17
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from c59321f to bf605a2 Compare September 20, 2026 00:19
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from e65339b to 32dcea1 Compare September 20, 2026 00:20
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from bf605a2 to aacf3b6 Compare September 20, 2026 05:24
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 32dcea1 to c99edd0 Compare September 20, 2026 05:24
@whowes
whowes removed this pull request from stack #14429 September 20, 2026 07:20
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from aacf3b6 to c36f0cd Compare September 20, 2026 07:45
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from c99edd0 to 06c48fe Compare September 20, 2026 07:46
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from c36f0cd to 17e0368 Compare September 21, 2026 18:33
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 06c48fe to 75003f3 Compare September 21, 2026 18:33
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from 17e0368 to 9f3a73f Compare September 21, 2026 20:26
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 75003f3 to cbdbd26 Compare September 21, 2026 20:26
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from 9f3a73f to efea040 Compare September 21, 2026 22:34
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from cbdbd26 to 5dad896 Compare September 21, 2026 22:34
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from efea040 to 0e50e79 Compare September 21, 2026 22:59
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 5dad896 to 3c7f4e9 Compare September 21, 2026 23:00
@whowes
whowes force-pushed the whowes/resumable-upload-watchdog branch from 0e50e79 to 2eb5a87 Compare September 21, 2026 23:36
@whowes
whowes force-pushed the whowes/resumable-upload-progress-model branch from 3c7f4e9 to deed08d Compare September 21, 2026 23:36
@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