src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> doOnSubscribe(Consumer<? super Disposable> onSubscribe) {
        return doOnLifecycle(onSubscribe, Functions.EMPTY_ACTION);
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> doOnSubscribe(Consumer<? super Disposable> onSubscribe) {
        return doOnLifecycle(onSubscribe, Functions.EMPTY_ACTION);
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnSubscribe ( Consumer < ? super Disposable > onSubscribe ) { return doOnLifecycle ( onSubscribe , Functions . EMPTY_ACTION ) ; }
Modifies the source {@code ObservableSource} so that it invokes the given action when it is subscribed from
its subscribers. Each subscription will result in an invocation of the given action except when the
source {@code ObservableSource} is reference counted, in which case the source {@code ObservableSource} will invoke
the given action for the first subscription.
<p>
<img width="640" height="390" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doOnSubscribe.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code doOnSubscribe} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param onSubscribe
the Consumer that gets called when an Observer subscribes to the current {@code Observable}
@return the source {@code ObservableSource} modified so as to call this Consumer when appropriate
@see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
Modifies the source { @code ObservableSource } so that it invokes the given action when it is subscribed from its subscribers . Each subscription will result in an invocation of the given action except when the source { @code ObservableSource } is reference counted in which case the source { @code ObservableSource } will invoke the given action for the first subscription . <p > <img width = 640 height = 390 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnSubscribe . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doOnSubscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >