ReactiveX/RxAndroid — pull request #13 by mironov-nsk (2014-09-14 14:18:01+00:00)
Title: [review-only] OperatorSynchronousUnsubscribe

Possible solution for the problem discussed here https://github.com/ReactiveX/RxAndroid/issues/3 and here https://github.com/ReactiveX/RxAndroid/issues/12.

`OperatorSynchronousUnsubscribe` ensures that a `Subscriber` passed to `Observable.subscribe` won't receive any notifications after `Subscription.unsubscribe` is called. It also releases a reference to prevent memory leaks.

In or order to work properly `OperatorSynchronousUnsubscribe` **must** be the latest lifted operator:

```java
final Subscription subscription = ViewObservable.clicks(button, false)
.observeOn(AndroidSchedulers.mainThread())
.lift(new OperatorSynchronousUnsubscribe())
.subscribe(new Action1() {
@Override
public void call(View view) {
Log.d("RxAndroid", "Button Clicked");
}
});
```

/cc @mttkay