Skip to content

Commit

Permalink
Removed unused code (#540)
Browse files Browse the repository at this point in the history
Cleanup for #525, removing unused methods and classes.
  • Loading branch information
NiteshKant authored Aug 14, 2016
1 parent 6f0522c commit e491d8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
import io.reactivex.netty.metrics.Clock;
import io.reactivex.netty.metrics.MetricEventsListener;
import io.reactivex.netty.metrics.MetricEventsSubject;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.Observable;
Expand All @@ -40,6 +34,10 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
* @author Nitesh Kant
Expand Down Expand Up @@ -249,13 +247,6 @@ public void shutdown() {
Observable.just(1L).subscribe(createShutdownAction());
}

private void performShutdownIfRequested() {

if (isShutdownRequested.get()) {
performShutdownIfPossible();
}
}

private Action1<Long> createShutdownAction() {
return new Action1<Long>() {
@Override
Expand Down Expand Up @@ -361,15 +352,6 @@ public void call(Throwable throwable) {
);
}

private void poolAlreadyClosed(PooledConnection<I, O> connection, long startTime, Subscriber<? super ObservableConnection<I, O>> subscriber) {

connection.closeUnderlyingChannel();
IllegalStateException exception = new IllegalStateException("Pool already shut down");
metricEventsSubject.onEvent(ClientMetricsEvent.POOL_ACQUIRE_FAILED,
Clock.onEndMillis(startTime), exception);
subscriber.onError(exception);
}

@Override
public Subscription subscribe(MetricEventsListener<? extends ClientMetricsEvent<?>> listener) {
return metricEventsSubject.subscribe(listener);
Expand Down Expand Up @@ -402,25 +384,4 @@ public void run() {
}
}
}

private class ShutdownTask implements Runnable {

private final ScheduledExecutorService executorService;

public ShutdownTask(ScheduledExecutorService executorService) {

this.executorService = executorService;
}

@Override
public void run() {
if (isShutdownPerformed.get()) {
executorService.shutdown();
}
boolean shutdownIsDone = performShutdownIfPossible();
if (shutdownIsDone) {
executorService.shutdown();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void testShutdown() throws Exception {
assertAllConnectionsReturned();
}

@Test(expected = IllegalStateException.class)
@Test(expected = IllegalStateException.class, timeout = 20000)
public void shouldThrowExceptionIfAcquireIsSubscribedToAfterShutdownOfPool() {
serverConnHandler.closeNewConnectionsOnReceive(false);
strategy.incrementMaxConnections(2);
Expand All @@ -262,7 +262,7 @@ public void shouldThrowExceptionIfAcquireIsSubscribedToAfterShutdownOfPool() {

}

@Test
@Test(timeout = 20000)
public void testShutdownWithNonReturnedConnections() throws Exception{
serverConnHandler.closeNewConnectionsOnReceive(false);
strategy.incrementMaxConnections(2);
Expand Down

0 comments on commit e491d8f

Please sign in to comment.