FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: add AppendableUploadWriteableByteChannel#flush() by BenWhitehead · Pull Request #3261 · googleapis/java-storage · GitHub

feat: add AppendableUploadWriteableByteChannel#flush() - #3261

Merged
BenWhitehead merged 1 commit into
mainfrom
app/flush
Aug 25, 2025
Merged

feat: add AppendableUploadWriteableByteChannel#flush()#3261
BenWhitehead merged 1 commit into
mainfrom
app/flush

Conversation

Copy link
Copy Markdown
Collaborator

Allows blocking the invoking thread until the number of bytes acknowledged by GCS matches the number of written bytes prior to calling flush().

BenWhitehead requested a review from a team August 22, 2025 19:46
product-auto-label Bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/java-storage API. labels Aug 22, 2025
Allows blocking the invoking thread until the number of bytes acknowledged by GCS matches the number of written bytes prior to calling flush().

@Override
public void awaitAck(long writeOffset) throws InterruptedException {
lock.lock();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

question: why are we using lock here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The Condition confirmedBytesUpdated is tied to the lock instance.

Conditions (also known as condition queues or condition variables) provide a means for one thread to suspend execution (to "wait") until notified by another thread that some state condition may now be true. Because access to this shared state information occurs in different threads, it must be protected, so a lock of some form is associated with the condition. The key property that waiting for a condition provides is that it atomically releases the associated lock and suspends the current thread, just like Object.wait. [1]

When we await the condition on line 903, the lock will automatically be released while the invoking thread waits for the call of await to return.

BenWhitehead merged commit 950c56f into main Aug 25, 2025
25 checks passed
BenWhitehead deleted the app/flush branch August 25, 2025 16:55
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

Labels

api: storage Issues related to the googleapis/java-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL