|
20 | 20 | import io.reactivex.netty.metrics.Clock;
|
21 | 21 | import io.reactivex.netty.metrics.MetricEventsListener;
|
22 | 22 | 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; |
29 | 23 | import org.slf4j.Logger;
|
30 | 24 | import org.slf4j.LoggerFactory;
|
31 | 25 | import rx.Observable;
|
|
40 | 34 | import java.util.concurrent.ScheduledFuture;
|
41 | 35 | import java.util.concurrent.TimeUnit;
|
42 | 36 | 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; |
43 | 41 |
|
44 | 42 | /**
|
45 | 43 | * @author Nitesh Kant
|
@@ -249,13 +247,6 @@ public void shutdown() {
|
249 | 247 | Observable.just(1L).subscribe(createShutdownAction());
|
250 | 248 | }
|
251 | 249 |
|
252 |
| - private void performShutdownIfRequested() { |
253 |
| - |
254 |
| - if (isShutdownRequested.get()) { |
255 |
| - performShutdownIfPossible(); |
256 |
| - } |
257 |
| - } |
258 |
| - |
259 | 250 | private Action1<Long> createShutdownAction() {
|
260 | 251 | return new Action1<Long>() {
|
261 | 252 | @Override
|
@@ -361,15 +352,6 @@ public void call(Throwable throwable) {
|
361 | 352 | );
|
362 | 353 | }
|
363 | 354 |
|
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 |
| - |
373 | 355 | @Override
|
374 | 356 | public Subscription subscribe(MetricEventsListener<? extends ClientMetricsEvent<?>> listener) {
|
375 | 357 | return metricEventsSubject.subscribe(listener);
|
@@ -402,25 +384,4 @@ public void run() {
|
402 | 384 | }
|
403 | 385 | }
|
404 | 386 | }
|
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 |
| - } |
426 | 387 | }
|
0 commit comments