File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
src/main/java/rx/internal/operators Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -79,16 +79,13 @@ public void call(Subscriber<? super R> subscriber) {
79
79
public void connect (Action1 <? super Subscription > connection ) {
80
80
// each time we connect we create a new Subject and Subscription
81
81
82
- boolean shouldSubscribe = false ;
83
-
84
82
// subscription is the state of whether we are connected or not
85
83
synchronized (guard ) {
86
84
if (subscription != null ) {
87
85
// already connected
88
86
connection .call (guardedSubscription );
89
87
return ;
90
88
} else {
91
- shouldSubscribe = true ;
92
89
// we aren't connected, so let's create a new Subject and connect
93
90
final Subject <? super T , ? extends R > subject = subjectFactory .call ();
94
91
// create new Subscriber that will pass-thru to the subject we just created
@@ -143,18 +140,16 @@ public void call() {
143
140
}
144
141
145
142
// in the lock above we determined we should subscribe, do it now outside the lock
146
- if (shouldSubscribe ) {
147
- // register a subscription that will shut this down
148
- connection .call (guardedSubscription );
143
+ // register a subscription that will shut this down
144
+ connection .call (guardedSubscription );
149
145
150
- // now that everything is hooked up let's subscribe
151
- // as long as the subscription is not null (which can happen if already unsubscribed)
152
- Subscriber <T > sub ;
153
- synchronized (guard ) {
154
- sub = subscription ;
155
- }
156
- if (sub != null )
157
- source .subscribe (sub );
146
+ // now that everything is hooked up let's subscribe
147
+ // as long as the subscription is not null (which can happen if already unsubscribed)
148
+ Subscriber <T > sub ;
149
+ synchronized (guard ) {
150
+ sub = subscription ;
158
151
}
152
+ if (sub != null )
153
+ source .subscribe (sub );
159
154
}
160
155
}
You can’t perform that action at this time.
0 commit comments