This doesn't clear the subscriptions, just copies it. You could just pass out the Set and replace it with null.
```java
Set<Subscription> unsubscribe = null;
synchronized (this) {
    if (unsubscribed || subscriptions == null) {
        return;
    }
    unsubscribe = subscriptions;
    subscriptions = null;
}
unsubscribeFromAll(unsubscribe);
```