Skip to content

Commit e491d8f

Browse files
authored
Removed unused code (#540)
Cleanup for #525, removing unused methods and classes.
1 parent 6f0522c commit e491d8f

File tree

2 files changed

+6
-45
lines changed

2 files changed

+6
-45
lines changed

rxnetty/src/main/java/io/reactivex/netty/client/ConnectionPoolImpl.java

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
import io.reactivex.netty.metrics.Clock;
2121
import io.reactivex.netty.metrics.MetricEventsListener;
2222
import io.reactivex.netty.metrics.MetricEventsSubject;
23-
import java.util.concurrent.Executors;
24-
import java.util.concurrent.ThreadFactory;
25-
import java.util.concurrent.atomic.AtomicInteger;
26-
import java.util.concurrent.locks.Lock;
27-
import java.util.concurrent.locks.ReadWriteLock;
28-
import java.util.concurrent.locks.ReentrantReadWriteLock;
2923
import org.slf4j.Logger;
3024
import org.slf4j.LoggerFactory;
3125
import rx.Observable;
@@ -40,6 +34,10 @@
4034
import java.util.concurrent.ScheduledFuture;
4135
import java.util.concurrent.TimeUnit;
4236
import java.util.concurrent.atomic.AtomicBoolean;
37+
import java.util.concurrent.atomic.AtomicInteger;
38+
import java.util.concurrent.locks.Lock;
39+
import java.util.concurrent.locks.ReadWriteLock;
40+
import java.util.concurrent.locks.ReentrantReadWriteLock;
4341

4442
/**
4543
* @author Nitesh Kant
@@ -249,13 +247,6 @@ public void shutdown() {
249247
Observable.just(1L).subscribe(createShutdownAction());
250248
}
251249

252-
private void performShutdownIfRequested() {
253-
254-
if (isShutdownRequested.get()) {
255-
performShutdownIfPossible();
256-
}
257-
}
258-
259250
private Action1<Long> createShutdownAction() {
260251
return new Action1<Long>() {
261252
@Override
@@ -361,15 +352,6 @@ public void call(Throwable throwable) {
361352
);
362353
}
363354

364-
private void poolAlreadyClosed(PooledConnection<I, O> connection, long startTime, Subscriber<? super ObservableConnection<I, O>> subscriber) {
365-
366-
connection.closeUnderlyingChannel();
367-
IllegalStateException exception = new IllegalStateException("Pool already shut down");
368-
metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_FAILED,
369-
Clock.onEndMillis(startTime), exception);
370-
subscriber.onError(exception);
371-
}
372-
373355
@Override
374356
public Subscription subscribe(MetricEventsListener<? extends ClientMetricsEvent<?>> listener) {
375357
return metricEventsSubject.subscribe(listener);
@@ -402,25 +384,4 @@ public void run() {
402384
}
403385
}
404386
}
405-
406-
private class ShutdownTask implements Runnable {
407-
408-
private final ScheduledExecutorService executorService;
409-
410-
public ShutdownTask(ScheduledExecutorService executorService) {
411-
412-
this.executorService = executorService;
413-
}
414-
415-
@Override
416-
public void run() {
417-
if (isShutdownPerformed.get()) {
418-
executorService.shutdown();
419-
}
420-
boolean shutdownIsDone = performShutdownIfPossible();
421-
if (shutdownIsDone) {
422-
executorService.shutdown();
423-
}
424-
}
425-
}
426387
}

rxnetty/src/test/java/io/reactivex/netty/client/ConnectionPoolTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public void testShutdown() throws Exception {
251251
assertAllConnectionsReturned();
252252
}
253253

254-
@Test(expected = IllegalStateException.class)
254+
@Test(expected = IllegalStateException.class, timeout = 20000)
255255
public void shouldThrowExceptionIfAcquireIsSubscribedToAfterShutdownOfPool() {
256256
serverConnHandler.closeNewConnectionsOnReceive(false);
257257
strategy.incrementMaxConnections(2);
@@ -262,7 +262,7 @@ public void shouldThrowExceptionIfAcquireIsSubscribedToAfterShutdownOfPool() {
262262

263263
}
264264

265-
@Test
265+
@Test(timeout = 20000)
266266
public void testShutdownWithNonReturnedConnections() throws Exception{
267267
serverConnHandler.closeNewConnectionsOnReceive(false);
268268
strategy.incrementMaxConnections(2);

0 commit comments

Comments
 (0)