GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — simplify BlockingProcessStreamReader; fix tests by pongad · Pull Request #1457 · googleapis/google-cloud-java

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pongad
simplify BlockingProcessStreamReader; fix tests
fca0cfe
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.
@pongad
pongad requested a review from garrettjonesgoogle December 8, 2016 10:31
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 8, 2016
@coveralls

coveralls commented Dec 8, 2016

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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
@release-please
chore(main): release 2.3.7 (#1457)
7053efa
🤖 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
@renovate-bot
build(deps): update dependency org.apache.maven.plugins:maven-depende…
f879154
…ncy-plugin to v3.6.1 (#1457)
chingor13 pushed a commit that referenced this pull request Jan 6, 2026
@release-please
chore(main): release 0.132.5-alpha (#1457)
b25e915
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
@nzhenry @gcf-owl-bot
fix: set the correct database id on the key parent when calling Key#g…
992815d
…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 Jan 22, 2026
@release-please
chore(main): release 2.20.0 (#1454)
2d380e5
🤖 I have created a release *beep* *boop*
---


## [2.20.0](https://togithub.com/googleapis/java-datastore/compare/v2.19.3...v2.20.0) (2024-05-27)


### Features

* New PropertyMask field which allows partial commits, lookups, and query results ([#1455](https://togithub.com/googleapis/java-datastore/issues/1455)) ([ff5e397](https://togithub.com/googleapis/java-datastore/commit/ff5e39775446216b4806f55f14dacb7fc8e8854b))


### Bug Fixes

* Migrate off TextPrinter's deprecated methods ([#1452](https://togithub.com/googleapis/java-datastore/issues/1452)) ([c3c1317](https://togithub.com/googleapis/java-datastore/commit/c3c131735863d71971110e2ac7ac0244ce16ee92))
* Set the correct database id on the key parent when calling Key#getParent ([#1457](https://togithub.com/googleapis/java-datastore/issues/1457)) ([992815d](https://togithub.com/googleapis/java-datastore/commit/992815d9989d04f7b371dfa320ed17894626a07f))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
chingor13 pushed a commit that referenced this pull request Feb 24, 2026
@zhumin8
chore: setup 1.23.x lts branch. (#1457)
2418691
suztomo pushed a commit to suztomo/google-cloud-java that referenced this pull request Mar 11, 2026
@renovate-bot
build(deps): update dependency org.apache.maven.plugins:maven-depende…
eb897c2
…ncy-plugin to v3.6.1 (googleapis#1457)
chingor13 pushed a commit that referenced this pull request Mar 12, 2026
@zhumin8
chore: setup 1.23.x lts branch. (#1457)
8e748f6
lqiu96 pushed a commit that referenced this pull request Mar 20, 2026
@release-please
chore(main): release 0.132.5-alpha (#1457)
1f171c8
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
@release-please
chore(main): release 2.15.2-SNAPSHOT (googleapis#1457)
dd5cae1
🤖 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).
suztomo pushed a commit that referenced this pull request Mar 30, 2026
@renovate-bot
deps: update dependency com.google.cloud:google-cloud-storage to v2.4…
a580b87
…2.0 (#1457)
lqiu96 pushed a commit that referenced this pull request Apr 1, 2026
@renovate-bot
deps: update dependency com.google.cloud:google-cloud-storage to v2.4…
354d53c
…2.0 (#1457)
meltsufin pushed a commit that referenced this pull request Apr 29, 2026
@renovate-bot
build(deps): update dependency org.apache.maven.plugins:maven-depende…
71b787e
…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
@renovate-bot
build(deps): update dependency org.apache.maven.plugins:maven-depende…
9f315d0
…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
@release-please
chore(main): release 2.15.0 (googleapis#1457)
ce15f00
🤖 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

Reviewers

@garrettjonesgoogle garrettjonesgoogle Awaiting requested review from garrettjonesgoogle

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@pongad @coveralls @googlebot @garrettjonesgoogle
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.