Skip to content

Conversation

@pongad
Copy link
Contributor

@pongad pongad commented Feb 13, 2017

The snippet is very long, but the shortest I can make it without loosing
details.

The snippet is very long, but the shortest I can make it without loosing
details.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 13, 2017
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 5ee8bd3 on pongad:subscriber-snippet into ** on GoogleCloudPlatform:master**.

@garrettjonesgoogle
Copy link
Member

We shouldn't need locking for a simple example - how can we simplify this?

lesv
lesv previously approved these changes Feb 13, 2017
Copy link
Contributor

@lesv lesv left a comment

Choose a reason for hiding this comment

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

Any tests?

@lesv lesv dismissed their stale review February 13, 2017 22:32

Just saw Garrett's comments.

@lesv
Copy link
Contributor

lesv commented Feb 13, 2017

It does seem overly complex and the locks shouldn't be needed in typical usage. You really only need them if you are trying to run everything on the main thread, instead of thinking threaded and async.

@lesv lesv closed this Feb 13, 2017
@lesv lesv reopened this Feb 13, 2017
if (pendingReceives.decrementAndGet() != 0) {
return;
}
lock.lock();

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 5ee8bd3 on pongad:subscriber-snippet into ** on GoogleCloudPlatform:master**.

pongad added a commit to googleapis/gax-java that referenced this pull request Feb 16, 2017
This should be merged after
#205
so that `SettableRpcFuture` could be used to address
googleapis/google-cloud-java#1613
@pongad
Copy link
Contributor Author

pongad commented Feb 20, 2017

@lesv @garrettjonesgoogle PTAL. I'll add the tests for both Subscriber and Publisher in one go. They kind of belong in the same test anyway.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.008%) to 81.116% when pulling 4bd5d48 on pongad:subscriber-snippet into 68ce84d on GoogleCloudPlatform:master.

* if (pendingReceives.decrementAndGet() != 0) {
* return;
* }
* lock.lock();

This comment was marked as spam.

@pongad
Copy link
Contributor Author

pongad commented Feb 21, 2017

@garrettjonesgoogle My mistake, PTAL

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.008%) to 81.116% when pulling 4f95f59 on pongad:subscriber-snippet into 68ce84d on GoogleCloudPlatform:master.

@garrettjonesgoogle
Copy link
Member

LGTM with the understanding that tests will come next

@pongad
Copy link
Contributor Author

pongad commented Feb 21, 2017

@lesv PTAL

});
subscriber.startAsync();

done.get(10, TimeUnit.MINUTES);

This comment was marked as spam.

System.out.println("got message: " + message);
consumer.accept(AckReply.ACK, null);
if (pendingReceives.decrementAndGet() == 0) {
done.set(null);

This comment was marked as spam.

Copy link
Contributor

@lesv lesv left a comment

Choose a reason for hiding this comment

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

Let's separate support from the action of the API.

@pongad
Copy link
Contributor Author

pongad commented Feb 22, 2017

@lesv I think the updated snippets should do what you want. I think it gives us just enough room to properly test the samples too.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 81.113% when pulling 3717f02 on pongad:subscriber-snippet into 68ce84d on GoogleCloudPlatform:master.

Copy link
Contributor

@lesv lesv left a comment

Choose a reason for hiding this comment

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

Just add the comment. -- Thanks.

@jabubake FYI

MessageReceiver receiver = new MessageReceiver() {
public void receiveMessage(final PubsubMessage message, final AckReplyConsumer consumer) {
if (blockingQueue.offer(message)) {
consumer.accept(AckReply.ACK, null);

This comment was marked as spam.

This comment was marked as spam.

@pongad
Copy link
Contributor Author

pongad commented Feb 22, 2017

@lesv Thank you for the rigorous code review. I'll wait for Travis, then merge this.

@pongad pongad merged commit 235874d into googleapis:master Feb 22, 2017
@pongad pongad deleted the subscriber-snippet branch February 22, 2017 23:34
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.004%) to 81.113% when pulling b283ea1 on pongad:subscriber-snippet into e61ca31 on GoogleCloudPlatform:master.

meltsufin pushed a commit that referenced this pull request Dec 22, 2025
🤖 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).
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.

5 participants