dehora / nakadi-java

🌀 Client library for the Nakadi Event Broker (examples: http://bit.ly/njc-examples, site: https://dehora.github.io/nakadi-java/)
MIT License
30 stars 19 forks source link

Cleanup: use logical 'and' for booleans #304

Closed PetrGlad closed 7 years ago

PetrGlad commented 7 years ago

Not a bug, bus still looks suspicious of first sight.

This is more of a comment. I see that StreamProcessor#stopping() checks both this.stopped and this.stopping while in both cases when stopping is used both StreamProcessor#stopping() and StreamProcessor#stopped() are invoked:

So this looks redundant. That is StreamProcessor#stopping() could check only this.stopping without logic change, or, alternatively, leave only StreamProcessor#stopped that would check both.

Another comment is that using 3 state variables stopping, stopped, and running begs for inconsistencies (e.g. running == true and stopped == true), I would implemented it a single state var and enum, say, [INIT, STARTED, STOPPING, STOPPED].

dehora commented 7 years ago

Another comment is that using 3 state variables stopping, stopped, and running begs for inconsistencies (e.g. running == true and stopped == true), I would implemented it a single state var and enum, say, [INIT, STARTED, STOPPING, STOPPED].

That's fair and a pull request is welcome.

dehora commented 7 years ago

lgtm :shipit:

PetrGlad commented 7 years ago

I'll try to prepare the PR for started/stopped flags. If no one is working on this yet.