How to execute Completable on Subscribe/Unsubscribe
<p>There is my method:</p>

<pre><code>public void openWorkshift(WorkshiftSettings workshiftSettings, Subscriber&lt;WorkshiftSettings&gt; subscriber) {
    api.openWorkshift(workshiftSettings)
            .compose(RxOperatorsHelpers.additionalStacktrace())
            .doOnSubscribe(() -&gt; actionsSystem.registerAction(...).await()) // &lt;-
            .doOnUnsubscribe(() -&gt; actionsSystem.unregisterAction(...).await()); // &lt;-
            .subscribeOn(ioScheduler)
            .observeOn(uiScheduler)
            .doOnError(this::handleError)
            .subscribe(subscriber);
}
</code></pre>

<p>Where <code>ActionsSystem.registerAction(...)</code>/<code>ActionsSystem.unregisterActions(...)</code> looks like that:</p>

<pre><code>public Completable registerAction(OperatorAction action) {
    return Completable.fromAction(() -&gt; actions.add(action));
}

public Completable unregisterAction(OperatorAction action) {
    return Completable.fromAction(() -&gt; actions.remove(action));
}
</code></pre>

<p>As you can see, I use <code>.await()</code> to execute <code>Completable</code> in flow of source Observable. It feels like wrong solution. <strong>How can I do it more elegant?</strong></p>