Netflix/RxJava — pull request #603 by akarnokd (2013-12-11 14:59:41+00:00)
Title: Significant restructuring of subscriptions

I've re-abstracted the subscriptions to be more uniform and maintenance friendly.

- Enhanced BooleanSubscription to support inheritance and single unsubscription action through ```onUnsubscribe```.
- Added ```BooleanSubscription.withAction``` to allow wrapping a single-time unsubscription action.
- Created ```AbstractAtomicSubscription``` which manages the lock-free manipulations through callbacks.
- Rewritted ```MultipleAssignmentSubscription``` to have two extension points in its logic, which allows simpler subclass implementations of ```SerialSubscription``` and ```SingleAssignmentSubscription```. ```MultipleAssignmentSubscription``` does not extend ```AbstractAtomicSubscription``` because it has a much simpler state-transition logic whereas the ```AbstractAtomicSubscription``` with its callbacks would be an overkill.
- Rewritten ```CompositeSubscription``` and ```RefCountSubscription``` to use ```AbstractAtomicSubscription```.
- Modified ```SafeObservableSubscription``` to use ```SingleAssignmentSubscription``` instead of duplicating its behavior.
- Extended ```Subscriptions``` with an ```unsubscribeAll``` method to capture the exception collection behavior when unsubscribing from multiple subscriptions.
- Added ```empty0()```, ```empty1()``` and ```empty2()``` convenience methods to Actions. Haven't checked if such no-op ActionX instances are created manually somewhere.
- BONUS: ```ValuedCompositeSubscription``` class where a value can be associated with a ```Subscription``` key.