Skip to content

Commit 36c50f9

Browse files
committed
Merge pull request #3500 from dromato/1.x
Some code clean ups.
2 parents e802bb7 + 5427db8 commit 36c50f9

26 files changed

+36
-57
lines changed

src/main/java/rx/internal/operators/BlockingOperatorNext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ public boolean hasNext() {
7979
}
8080
// Since an iterator should not be used in different thread,
8181
// so we do not need any synchronization.
82-
if (hasNext == false) {
82+
if (!hasNext) {
8383
// the iterator has reached the end.
8484
return false;
8585
}
86-
if (isNextConsumed == false) {
86+
if (!isNextConsumed) {
8787
// next has not been used yet.
8888
return true;
8989
}

src/main/java/rx/internal/operators/OnSubscribeRedo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public void call(final Subscriber<? super T> child) {
195195
final AtomicBoolean resumeBoundary = new AtomicBoolean(true);
196196

197197
// incremented when requests are made, decremented when requests are fulfilled
198-
final AtomicLong consumerCapacity = new AtomicLong(0l);
198+
final AtomicLong consumerCapacity = new AtomicLong();
199199

200200
final Scheduler.Worker worker = scheduler.createWorker();
201201
child.add(worker);

src/main/java/rx/internal/operators/OperatorBufferWithSize.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ public void request(long n) {
156156
}
157157
if (n == Long.MAX_VALUE) {
158158
requestInfinite();
159-
return;
160159
} else {
161160
if (firstRequest) {
162161
firstRequest = false;

src/main/java/rx/internal/operators/OperatorConcat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,5 +229,5 @@ public void setProducer(Producer producer) {
229229
arbiter.setProducer(producer);
230230
}
231231

232-
};
232+
}
233233
}

src/main/java/rx/internal/operators/OperatorWindowWithSize.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ public void onNext(T t) {
117117
noWindow = true;
118118
if (child.isUnsubscribed()) {
119119
unsubscribe();
120-
return;
121120
}
122121
}
123122
}

src/main/java/rx/internal/operators/OperatorWithLatestFrom.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public void onNext(T t) {
6060
s.onNext(result);
6161
} catch (Throwable e) {
6262
Exceptions.throwOrReport(e, this);
63-
return;
6463
}
6564
}
6665
}

src/main/java/rx/internal/schedulers/EventLoopsScheduler.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,16 @@ public Subscription schedule(Action0 action) {
160160
if (isUnsubscribed()) {
161161
return Subscriptions.unsubscribed();
162162
}
163-
ScheduledAction s = poolWorker.scheduleActual(action, 0, null, serial);
164-
165-
return s;
163+
164+
return poolWorker.scheduleActual(action, 0, null, serial);
166165
}
167166
@Override
168167
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
169168
if (isUnsubscribed()) {
170169
return Subscriptions.unsubscribed();
171170
}
172-
ScheduledAction s = poolWorker.scheduleActual(action, delayTime, unit, timed);
173-
174-
return s;
171+
172+
return poolWorker.scheduleActual(action, delayTime, unit, timed);
175173
}
176174
}
177175

src/main/java/rx/internal/schedulers/GenericScheduledExecutorService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public void start() {
7070
NewThreadWorker.registerExecutor((ScheduledThreadPoolExecutor)exec);
7171
}
7272
}
73-
return;
7473
} else {
7574
exec.shutdownNow();
7675
}

src/main/java/rx/internal/util/SubscriptionRandomList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void clear() {
108108
}
109109

110110
public void forEach(Action1<T> action) {
111-
T[] ss=null;
111+
T[] ss = null;
112112
synchronized (this) {
113113
if (unsubscribed || subscriptions == null) {
114114
return;

src/main/java/rx/observables/AbstractOnSubscribe.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,7 @@ protected boolean use() {
597597
*/
598598
protected void free() {
599599
int i = inUse.get();
600-
if (i <= 0) {
601-
return;
602-
} else
603-
if (inUse.decrementAndGet() == 0) {
600+
if (i > 0 && inUse.decrementAndGet() == 0) {
604601
parent.onTerminated(state);
605602
}
606603
}

0 commit comments

Comments
 (0)