| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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(); |
There was a problem hiding this comment.
question: why are we using lock here?
Sorry, something went wrong.
There was a problem hiding this comment.
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.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Allows blocking the invoking thread until the number of bytes acknowledged by GCS matches the number of written bytes prior to calling flush().