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

EventStream refactoring #238

Merged
merged 6 commits into from
Aug 27, 2018
Merged

EventStream refactoring #238

merged 6 commits into from
Aug 27, 2018

Conversation

moio
Copy link
Member

@moio moio commented Aug 21, 2018

This is a set of 5 refactorings to detach EventStream from its WebSocket implementation and allow alternative implementations.

This is needed in order to replace reading from WebSockets completely in Uyuni where we plan to read them from a Postgres database filled by a custom Salt Engine.

Best reviewed commit-by-commit.

@moio moio requested review from renner and lucidd and removed request for renner August 21, 2018 13:32
@renner renner added this to the Version 1.0.0 milestone Aug 23, 2018
@moio
Copy link
Member Author

moio commented Aug 27, 2018

JFI: I pushed a rebased version of these changes against v0.14 in https://github.com/SUSE/salt-netapi-client/tree/v0.15.0-event-stream-refactoring

I am not opening a PR unless you tell me otherwise.

protected void clearListeners(int code, String phrase) {
synchronized (listeners) {
listeners.stream()
.forEach(listener -> listener.eventStreamClosed(code, phrase));
Copy link
Member

Choose a reason for hiding this comment

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

Just a nitpick: there is different indentation used here and above, maybe those expressions would even fit on one line? By the way: it seems that it is possible to omit the stream() and call forEach() directly on Java 8 Iterables.

Copy link
Member Author

Choose a reason for hiding this comment

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

Polish added

@moio
Copy link
Member Author

moio commented Aug 27, 2018

I added one extra commit to handle the case in which event listeners are removed from some method called by notify. We use this for the Salt Remote Command feature in Uyuni.

I am merging as soon as Travis is happy.

@moio moio merged commit de2f4da into master Aug 27, 2018
@moio moio deleted the event-stream-refactoring branch August 27, 2018 14:43
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.

None yet

3 participants