Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MqttSubscriptionClient: connection lost (issue #22) #41

Merged
merged 1 commit into from
Sep 24, 2018

Conversation

olga-dorogan
Copy link
Contributor

Issue #22 : MqttSubscriptionClient: connection lost

Description of changes:
Added creation of HashSet with subscription objects just before iteration in onError() callback in subscribe() method.
As iteration over getSubscriptionObjects() result is not synchronized with other methods that can changesubscriptionsByTopic field value, modification of topic subscribers while onError() callback is in progress can cause ConcurrentModificationException. As subscriber (SubscriptionObject), for whom onError() should trigger onFailure() on listeners, already has been added to the set, the simplest way is to create copy of getSubscriptionObjects() result and iterate over it.
I tried to use 1.1.0 version of org.eclipse.paho:org.eclipse.paho.client.mqttv3 with the latest versions of other libraries as suggested in the issue comments, but in this case subscription called OnCompleted() right after it had been started and didn't send any successfull responses.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@scb01
Copy link
Contributor

scb01 commented Sep 24, 2018

@olga-dorogan
Thank you for your help in making this SDK better. The changes look great and I will merge them in.

@scb01 scb01 merged commit 2d7ceab into awslabs:master Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants