diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java index 1d56c61a7e..7e38d8cfa7 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java @@ -15,7 +15,6 @@ package org.hyperledger.besu.ethereum.eth.manager.peertask; import org.hyperledger.besu.ethereum.eth.manager.EthPeer; -import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.manager.exceptions.NoAvailablePeersException; import org.hyperledger.besu.ethereum.p2p.rlpx.connections.PeerConnection; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; @@ -27,7 +26,6 @@ import org.hyperledger.besu.plugin.services.metrics.OperationTimer; import java.util.Collection; import java.util.HashSet; import java.util.Optional; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; @@ -39,18 +37,15 @@ public class PeerTaskExecutor { public static final int NO_RETRIES = 0; private final PeerSelector peerSelector; private final PeerTaskRequestSender requestSender; - private final EthScheduler ethScheduler; private final LabelledMetric requestTimer; public PeerTaskExecutor( final PeerSelector peerSelector, final PeerTaskRequestSender requestSender, - final EthScheduler ethScheduler, final MetricsSystem metricsSystem) { this.peerSelector = peerSelector; this.requestSender = requestSender; - this.ethScheduler = ethScheduler; requestTimer = metricsSystem.createLabelledTimer( BesuMetricCategory.PEERS, @@ -87,11 +82,6 @@ public class PeerTaskExecutor { return executorResult; } - public CompletableFuture> executeAsync(final PeerTask peerTask) { - return ethScheduler.scheduleSyncWorkerTask( - () -> CompletableFuture.completedFuture(execute(peerTask))); - } - public PeerTaskExecutorResult executeAgainstPeer( final PeerTask peerTask, final EthPeer peer) { MessageData requestMessageData = peerTask.getRequestMessage(); @@ -144,12 +134,6 @@ public class PeerTaskExecutor { return executorResult; } - public CompletableFuture> executeAgainstPeerAsync( - final PeerTask peerTask, final EthPeer peer) { - return ethScheduler.scheduleSyncWorkerTask( - () -> CompletableFuture.completedFuture(executeAgainstPeer(peerTask, peer))); - } - private boolean sleepBetweenRetries() { try { // sleep for 1 second to match implemented wait between retries in AbstractRetryingPeerTask diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutorTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutorTest.java index 1bad6f2cc0..55878d144e 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutorTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutorTest.java @@ -15,7 +15,6 @@ package org.hyperledger.besu.ethereum.eth.manager.peertask; import org.hyperledger.besu.ethereum.eth.manager.EthPeer; -import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.p2p.rlpx.connections.PeerConnection; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.SubProtocol; @@ -38,7 +37,6 @@ import org.mockito.MockitoAnnotations; public class PeerTaskExecutorTest { private @Mock PeerSelector peerSelector; private @Mock PeerTaskRequestSender requestSender; - private @Mock EthScheduler ethScheduler; private @Mock PeerTask peerTask; private @Mock SubProtocol subprotocol; private @Mock MessageData requestMessageData; @@ -52,7 +50,7 @@ public class PeerTaskExecutorTest { public void beforeTest() { mockCloser = MockitoAnnotations.openMocks(this); peerTaskExecutor = - new PeerTaskExecutor(peerSelector, requestSender, ethScheduler, new NoOpMetricsSystem()); + new PeerTaskExecutor(peerSelector, requestSender, new NoOpMetricsSystem()); } @AfterEach