Skip to content

Commit

Permalink
Dont keep indents on empty lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
Klemen Kresnik committed Feb 19, 2016
1 parent edacaf9 commit 5ec27bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/main/java/rx/subscriptions/CompositeSubscription.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@
* All methods of this class are thread-safe.
*/
public final class CompositeSubscription implements Subscription {

private Set<Subscription> subscriptions;
private volatile boolean unsubscribed;

public CompositeSubscription() {
}

public CompositeSubscription(final Subscription... subscriptions) {
this.subscriptions = new HashSet<Subscription>(Arrays.asList(subscriptions));
}

@Override
public boolean isUnsubscribed() {
return unsubscribed;
}

/**
* Adds a new {@link Subscription} to this {@code CompositeSubscription} if the
* {@code CompositeSubscription} is not yet unsubscribed. If the {@code CompositeSubscription} <em>is</em>
Expand Down Expand Up @@ -74,7 +74,7 @@ public void add(final Subscription s) {
// call after leaving the synchronized block so we're not holding a lock while executing this
s.unsubscribe();
}

/**
* Adds collection of {@link Subscription} to this {@code CompositeSubscription} if the
* {@code CompositeSubscription} is not yet unsubscribed. If the {@code CompositeSubscription} <em>is</em>
Expand All @@ -91,7 +91,7 @@ public void addAll(final Subscription... subscriptions) {
subscriptionList.add(s);
}
}

if (!unsubscribed) {
synchronized (this) {
if (!unsubscribed) {
Expand All @@ -103,12 +103,12 @@ public void addAll(final Subscription... subscriptions) {
}
}
}

for (Subscription s : subscriptionList) {
s.unsubscribe();
}
}

/**
* Removes a {@link Subscription} from this {@code CompositeSubscription}, and unsubscribes the
* {@link Subscription}.
Expand All @@ -131,7 +131,7 @@ public void remove(final Subscription s) {
}
}
}

/**
* Unsubscribes any subscriptions that are currently part of this {@code CompositeSubscription} and remove
* them from the {@code CompositeSubscription} so that the {@code CompositeSubscription} is empty and
Expand All @@ -151,7 +151,7 @@ public void clear() {
unsubscribeFromAll(unsubscribe);
}
}

/**
* Unsubscribes itself and all inner subscriptions.
* <p>After call of this method, new {@code Subscription}s added to {@link CompositeSubscription}
Expand All @@ -173,7 +173,7 @@ public void unsubscribe() {
unsubscribeFromAll(unsubscribe);
}
}

private static void unsubscribeFromAll(Collection<Subscription> subscriptions) {
if (subscriptions == null) {
return;
Expand All @@ -191,7 +191,7 @@ private static void unsubscribeFromAll(Collection<Subscription> subscriptions) {
}
Exceptions.throwIfAny(es);
}

/**
* Returns true if this composite is not unsubscribed and contains subscriptions.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public boolean isUnsubscribed() {

assertEquals(2, counter.get());
}

@Test(timeout = 1000)
public void shouldUnsubscribeAll() throws InterruptedException {
final AtomicInteger counter = new AtomicInteger();
Expand Down

0 comments on commit 5ec27bf

Please sign in to comment.