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.
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
XEP-0172 Improvement #276
base: master
Are you sure you want to change the base?
XEP-0172 Improvement #276
Changes from 6 commits
86c1d38
f1912cd
e58a3ef
fad201c
647950d
7ee730d
e439bf1
7e0d1e5
a2ce275
acc1452
da9a9f2
cfc05ae
9cced75
6b4de5e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
AsyncButOrdered
API is not correctly used. Right now, it assures the runnable is ordered with respect to the message, when it should be ordered with respect to the originating entity.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain me a little bit more about what could be the originating entiy?
Because there is no much doc about that
AsyncButOrdered
I have been using it as I saw in others parts of Smack, so it's not much clear to me how should I use it or when or the options I have instead it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The originating entity is the entity that send the message stanza. So you need to replace
message
withmessage.getFrom()
. But make sure to add a null check.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and what if it is null? I mean, should I throw an exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nickListeners
is not synchronized although it should beThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean something like:
am I right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, or some other sort of means to ensure access to the datastructure is properly synchronized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, added a synchronized, tell me if that is enough or you like another kind of synchronized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That synchronization is broken: You are protecting nickListeners with the Manager's object monitor and above you use the nickListeners's monitor.