Skip to content

simplify BlockingProcessStreamReader; fix tests#1457

Merged
garrettjonesgoogle merged 1 commit into
googleapis:masterfrom
pongad:stream-reader
Dec 8, 2016
Merged

simplify BlockingProcessStreamReader; fix tests#1457
garrettjonesgoogle merged 1 commit into
googleapis:masterfrom
pongad:stream-reader

Conversation

@pongad

@pongad pongad commented Dec 8, 2016

Copy link
Copy Markdown
Contributor

Update #1429.

This commit simplifies the main run() method.
Previous implementation checks whether the underlying Reader is ready to read
then either reads a line or sleeps,
catching InterruptedException to watch for any thread interruption.

There are subtle difficulties with this approach:

  • Even if the underlying Reader is ready to read, it might not have
    enough bytes to form a line. It might still block.
  • It's not necessary to sleep. If the thread is interrupted while
    reading. It should throw InterruptedIOException.
    The method now reads in a loop, waiting for either exceptions or EOF.

The test class implements a mock Logger that logs to a data structure.
It then verifies that the data structure holds appropriate logs.
As implemented, this can cause a race, as two threads,
the writer and the verifier, run concurrently.
This commit fixes this by waiting for the writing thread to terminate
before verifying.

Update #1429.

This commit simplifies the main run() method.
Previous implementation checks whether the underlying Reader is ready to read
then either reads a line or sleeps,
catching InterruptedException to watch for any thread interruption.

There are subtle difficulties with this approach:
- Even if the underlying Reader is ready to read, it might not have
  enough bytes to form a line. It might still block.
- It's not necessary to sleep. If the thread is interrupted while
  reading. It should throw InterruptedIOException.
The method now reads in a loop, waiting for either exceptions or EOF.

The test class implements a mock Logger that logs to a data structure.
It then verifies that the data structure holds appropriate logs.
As implemented, this can cause a race, as two threads,
the writer and the verifier, run concurrently.
This commit fixes this by waiting for the writing thread to terminate
before verifying.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 8, 2016
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.01%) to 83.577% when pulling fca0cfe on pongad:stream-reader into cacf65e on GoogleCloudPlatform:master.

@garrettjonesgoogle garrettjonesgoogle merged commit 614cbe4 into googleapis:master Dec 8, 2016
@pongad pongad deleted the stream-reader branch December 12, 2016 03:33
github-actions Bot pushed a commit that referenced this pull request Sep 15, 2022
🤖 I have created a release *beep* *boop*
---


## [2.3.7](googleapis/java-bigquerydatatransfer@v2.3.6...v2.3.7) (2022-08-29)


### Dependencies

* update dependency com.google.cloud:google-cloud-bigquery to v2.15.0 ([#1456](googleapis/java-bigquerydatatransfer#1456)) ([a20b6e6](googleapis/java-bigquerydatatransfer@a20b6e6))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
meltsufin pushed a commit that referenced this pull request Dec 22, 2025
chingor13 pushed a commit that referenced this pull request Jan 6, 2026
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
chingor13 pushed a commit that referenced this pull request Jan 22, 2026
…etParent (#1457)

* fix: set database ID on parent key

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
chingor13 pushed a commit that referenced this pull request Feb 24, 2026
suztomo pushed a commit to suztomo/google-cloud-java that referenced this pull request Mar 11, 2026
chingor13 pushed a commit that referenced this pull request Mar 12, 2026
lqiu96 pushed a commit that referenced this pull request Mar 20, 2026
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
suztomo pushed a commit to suztomo/google-cloud-java that referenced this pull request Mar 23, 2026
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
meltsufin pushed a commit that referenced this pull request Apr 29, 2026
…ncy-plugin to v3.5.0 - abandoned (#1457)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.apache.maven.plugins:maven-dependency-plugin](https://maven.apache.org/plugins/) | `3.4.0` -> `3.5.0` | [![age](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-dependency-plugin/3.5.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-dependency-plugin/3.5.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-dependency-plugin/3.5.0/compatibility-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-dependency-plugin/3.5.0/confidence-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-pubsub).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43My4zIiwidXBkYXRlZEluVmVyIjoiMzQuOTcuNiJ9-->
meltsufin pushed a commit that referenced this pull request May 1, 2026
…ncy-plugin to v3.5.0 - abandoned (#1457)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.apache.maven.plugins:maven-dependency-plugin](https://maven.apache.org/plugins/) | `3.4.0` -> `3.5.0` | [![age](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-dependency-plugin/3.5.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-dependency-plugin/3.5.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-dependency-plugin/3.5.0/compatibility-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-dependency-plugin/3.5.0/confidence-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-pubsub).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43My4zIiwidXBkYXRlZEluVmVyIjoiMzQuOTcuNiJ9-->
benjaminp pushed a commit to benjaminp/google-cloud-java that referenced this pull request Jul 13, 2026
🤖 I have created a release *beep* *boop*
---


## [2.15.0](https://togithub.com/googleapis/java-bigtable/compare/v2.14.1...v2.15.0) (2022-10-26)


### Features

* Add apis for Mutation and RowMutationEntry ([googleapis#1454](https://togithub.com/googleapis/java-bigtable/issues/1454)) ([80b790e](https://togithub.com/googleapis/java-bigtable/commit/80b790e788b0658923af84d22a5522e5c9b54997))


### Bug Fixes

* Catch all throwables so version mismatch won't hang the client ([googleapis#1402](https://togithub.com/googleapis/java-bigtable/issues/1402)) ([39a5bae](https://togithub.com/googleapis/java-bigtable/commit/39a5baef5b4736ffe0b7e3217bcec945519e9bfa))
* Fix attempt status tag for metrics ([googleapis#1477](https://togithub.com/googleapis/java-bigtable/issues/1477)) ([4f54302](https://togithub.com/googleapis/java-bigtable/commit/4f543024649b1d2d37859e6ee723405a524fbe14))
* Rename metric names to match the external name ([googleapis#1479](https://togithub.com/googleapis/java-bigtable/issues/1479)) ([d892673](https://togithub.com/googleapis/java-bigtable/commit/d892673b0a2c5b6192bf3e73be0fd8f7f99a3aa1))
* Set a longer timeout to wait for callbacks to be executed ([googleapis#1478](https://togithub.com/googleapis/java-bigtable/issues/1478)) ([5ce39c0](https://togithub.com/googleapis/java-bigtable/commit/5ce39c07fa4786201b7cdcd845e4e76b4f9a2fa7))


### Dependencies

* Update dependency com.google.cloud:google-cloud-monitoring-bom to v3.5.0 ([googleapis#1464](https://togithub.com/googleapis/java-bigtable/issues/1464)) ([7a3e05a](https://togithub.com/googleapis/java-bigtable/commit/7a3e05a1b591a6937db37591b5638c7cede7cef3))
* Update dependency com.google.cloud:google-cloud-monitoring-bom to v3.6.0 ([googleapis#1476](https://togithub.com/googleapis/java-bigtable/issues/1476)) ([a7f06cf](https://togithub.com/googleapis/java-bigtable/commit/a7f06cf0fe60f2be383b89fe29d486285160b97f))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.5 ([googleapis#1470](https://togithub.com/googleapis/java-bigtable/issues/1470)) ([92d015e](https://togithub.com/googleapis/java-bigtable/commit/92d015e295968fb2272ba56c81a35b316124a319))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.15 ([googleapis#1462](https://togithub.com/googleapis/java-bigtable/issues/1462)) ([2b2151f](https://togithub.com/googleapis/java-bigtable/commit/2b2151f723ab50206034f5b46c21a3e58f3c043c))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.16 ([googleapis#1467](https://togithub.com/googleapis/java-bigtable/issues/1467)) ([4bd8753](https://togithub.com/googleapis/java-bigtable/commit/4bd8753df235cd6fd4db9cd0a3140f61e3ba899f))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.15 ([googleapis#1463](https://togithub.com/googleapis/java-bigtable/issues/1463)) ([c328264](https://togithub.com/googleapis/java-bigtable/commit/c328264cc3286f76b7760486ec62e1b1d0b83ad2))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.16 ([googleapis#1468](https://togithub.com/googleapis/java-bigtable/issues/1468)) ([99b03e5](https://togithub.com/googleapis/java-bigtable/commit/99b03e5a7d1fe29b889b9cd6fc51c63fd061a3ed))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants