Skip to content

Commit d7bd826

Browse files
committed
Code simplification
1 parent 9897ca8 commit d7bd826

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

rxjava-core/src/main/java/rx/subscriptions/SerialSubscription.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,7 @@ public void unsubscribe() {
3838

3939
@Override
4040
public void unsubscribe() {
41-
do {
42-
final Subscription current = reference.get();
43-
if (current == UNSUBSCRIBED) {
44-
break;
45-
}
46-
if (reference.compareAndSet(current, UNSUBSCRIBED)) {
47-
current.unsubscribe();
48-
break;
49-
}
50-
} while (true);
41+
setSubscription(UNSUBSCRIBED);
5142
}
5243

5344
public void setSubscription(final Subscription subscription) {
@@ -63,8 +54,4 @@ public void setSubscription(final Subscription subscription) {
6354
}
6455
} while (true);
6556
}
66-
67-
public Subscription getSubscription() {
68-
return reference.get();
69-
}
7057
}

0 commit comments

Comments
 (0)