File tree Expand file tree Collapse file tree 1 file changed +1
-31
lines changed
src/main/java/rx/subscriptions Expand file tree Collapse file tree 1 file changed +1
-31
lines changed Original file line number Diff line number Diff line change @@ -46,38 +46,8 @@ public static Subscription empty() {
46
46
* @return {@link Subscription}
47
47
*/
48
48
public static Subscription create (final Action0 unsubscribe ) {
49
- return new ActionSubscription (unsubscribe );
49
+ return BooleanSubscription . create (unsubscribe );
50
50
}
51
- /**
52
- * Subscription that delegates the unsubscription action to an Action0 instance
53
- */
54
- private static final class ActionSubscription implements Subscription {
55
- volatile Action0 actual ;
56
- static final AtomicReferenceFieldUpdater <ActionSubscription , Action0 > ACTUAL_UPDATER
57
- = AtomicReferenceFieldUpdater .newUpdater (ActionSubscription .class , Action0 .class , "actual" );
58
- public ActionSubscription (Action0 action ) {
59
- this .actual = action != null ? action : Actions .empty ();
60
- }
61
- @ Override
62
- public boolean isUnsubscribed () {
63
- return actual == UNSUBSCRIBED_ACTION ;
64
- }
65
- @ Override
66
- public void unsubscribe () {
67
- Action0 a = ACTUAL_UPDATER .getAndSet (this , UNSUBSCRIBED_ACTION );
68
- a .call ();
69
- }
70
- /** The no-op unique action indicating an unsubscribed state. */
71
- private static final Unsubscribed UNSUBSCRIBED_ACTION = new Unsubscribed ();
72
- /** Naming classes helps with debugging. */
73
- private static final class Unsubscribed implements Action0 {
74
- @ Override
75
- public void call () {
76
-
77
- }
78
- }
79
- }
80
-
81
51
82
52
/**
83
53
* Converts a {@link Future} into a {@link Subscription} and cancels it when unsubscribed.
You can’t perform that action at this time.
0 commit comments