Skip to content

Commit

Permalink
Remove unnecessary isCancelled() from code example (#1235)
Browse files Browse the repository at this point in the history
Cancelling an already canceled task has no effect. IMHO this check is not necesssary and removal would simplify the code. I came to this because I saw this pattern in many bindings during reviewing.

Signed-off-by: Fabian Wolter <github@fabian-wolter.de>
  • Loading branch information
fwolter authored Jun 16, 2020
1 parent b6209fe commit 1ea8216
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion developers/bindings/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ The following example shows the implementation of the above mentioned methods in
@Override
protected void stopBackgroundDiscovery() {
logger.debug("Stop WeMo device background discovery");
if (wemoDiscoveryJob != null && !wemoDiscoveryJob.isCancelled()) {
if (wemoDiscoveryJob != null) {
wemoDiscoveryJob.cancel(true);
wemoDiscoveryJob = null;
}
Expand Down

0 comments on commit 1ea8216

Please sign in to comment.