GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #1952 from zsxwing/remove-action-subscription · wgpshashank/RxJava@7b25665

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/main/java/rx/subscriptions
    • Subscriptions.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/rx/subscriptions/Subscriptions.java‎

Copy file name to clipboardExpand all lines: src/main/java/rx/subscriptions/Subscriptions.java
+1-31Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,8 @@ public static Subscription empty() {
4646
* @return {@link Subscription}
4747
*/
4848
public static Subscription create(final Action0 unsubscribe) {
49-
return new ActionSubscription(unsubscribe);
49+
return BooleanSubscription.create(unsubscribe);
5050
}
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-
8151

8252
/**
8353
* Converts a {@link Future} into a {@link Subscription} and cancels it when unsubscribed.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.