mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 09:20:04 +01:00
TestWithPeerGroup: remove unneeded use of ListeningScheduledExecutorService
There is no longer a need to decorate `ScheduledThreadPoolExecutor` to support `ListeningScheduledExecutorService` since `PeerGroup` no longer uses it.
This commit is contained in:
parent
5513f7dff0
commit
1b63903ad3
1 changed files with 4 additions and 5 deletions
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
package org.bitcoinj.testing;
|
package org.bitcoinj.testing;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListeningScheduledExecutorService;
|
|
||||||
import com.google.common.util.concurrent.MoreExecutors;
|
|
||||||
import org.bitcoinj.base.internal.TimeUtils;
|
import org.bitcoinj.base.internal.TimeUtils;
|
||||||
import org.bitcoinj.core.BloomFilter;
|
import org.bitcoinj.core.BloomFilter;
|
||||||
import org.bitcoinj.core.MemoryPoolMessage;
|
import org.bitcoinj.core.MemoryPoolMessage;
|
||||||
|
@ -40,6 +38,7 @@ import org.junit.rules.Timeout;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
|
@ -115,8 +114,8 @@ public class TestWithPeerGroup extends TestWithNetworkConnections {
|
||||||
private PeerGroup createPeerGroup(final ClientConnectionManager manager) {
|
private PeerGroup createPeerGroup(final ClientConnectionManager manager) {
|
||||||
return new PeerGroup(UNITTEST, blockChain, manager, PeerGroup.DEFAULT_BLOOM_FILTER_FP_RATE) {
|
return new PeerGroup(UNITTEST, blockChain, manager, PeerGroup.DEFAULT_BLOOM_FILTER_FP_RATE) {
|
||||||
@Override
|
@Override
|
||||||
protected ListeningScheduledExecutorService createPrivateExecutor() {
|
protected ScheduledExecutorService createPrivateExecutor() {
|
||||||
return MoreExecutors.listeningDecorator(new ScheduledThreadPoolExecutor(1, new ContextPropagatingThreadFactory("PeerGroup test thread")) {
|
return new ScheduledThreadPoolExecutor(1, new ContextPropagatingThreadFactory("PeerGroup test thread")) {
|
||||||
@Override
|
@Override
|
||||||
public ScheduledFuture<?> schedule(final Runnable command, final long delay, final TimeUnit unit) {
|
public ScheduledFuture<?> schedule(final Runnable command, final long delay, final TimeUnit unit) {
|
||||||
if (!blockJobs)
|
if (!blockJobs)
|
||||||
|
@ -127,7 +126,7 @@ public class TestWithPeerGroup extends TestWithNetworkConnections {
|
||||||
jobBlocks.acquireUninterruptibly();
|
jobBlocks.acquireUninterruptibly();
|
||||||
}, 0 /* immediate */, unit);
|
}, 0 /* immediate */, unit);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue