|
38 | 38 | import org.elasticsearch.common.transport.TransportAddress; |
39 | 39 | import org.elasticsearch.common.unit.TimeValue; |
40 | 40 | import org.elasticsearch.common.util.BigArrays; |
| 41 | +import org.elasticsearch.common.util.PageCacheRecycler; |
41 | 42 | import org.elasticsearch.common.util.concurrent.AbstractRunnable; |
42 | 43 | import org.elasticsearch.common.util.concurrent.ConcurrentCollections; |
43 | 44 | import org.elasticsearch.common.util.concurrent.EsExecutors; |
|
56 | 57 | import org.elasticsearch.transport.TransportRequestOptions; |
57 | 58 | import org.elasticsearch.transport.TransportResponseHandler; |
58 | 59 | import org.elasticsearch.transport.TransportService; |
| 60 | +import org.elasticsearch.transport.nio.MockNioTransport; |
59 | 61 | import org.junit.After; |
60 | 62 | import org.junit.Before; |
61 | 63 | import org.mockito.Matchers; |
@@ -143,14 +145,14 @@ public void testSimplePings() throws IOException, InterruptedException, Executio |
143 | 145 |
|
144 | 146 | NetworkService networkService = new NetworkService(Collections.emptyList()); |
145 | 147 |
|
146 | | - final BiFunction<Settings, Version, Transport> supplier = (s, v) -> new MockTcpTransport( |
| 148 | + final BiFunction<Settings, Version, Transport> supplier = (s, v) -> new MockNioTransport( |
147 | 149 | s, |
| 150 | + v, |
148 | 151 | threadPool, |
149 | | - BigArrays.NON_RECYCLING_INSTANCE, |
150 | | - new NoneCircuitBreakerService(), |
151 | | - new NamedWriteableRegistry(Collections.emptyList()), |
152 | 152 | networkService, |
153 | | - v); |
| 153 | + PageCacheRecycler.NON_RECYCLING_INSTANCE, |
| 154 | + new NamedWriteableRegistry(Collections.emptyList()), |
| 155 | + new NoneCircuitBreakerService()); |
154 | 156 |
|
155 | 157 | NetworkHandle handleA = startServices(settings, threadPool, "UZP_A", Version.CURRENT, supplier); |
156 | 158 | closeables.push(handleA.transportService); |
@@ -268,14 +270,14 @@ public void testUnknownHostNotCached() throws ExecutionException, InterruptedExc |
268 | 270 | final NetworkService networkService = new NetworkService(Collections.emptyList()); |
269 | 271 |
|
270 | 272 | final Map<String, TransportAddress[]> addresses = new HashMap<>(); |
271 | | - final BiFunction<Settings, Version, Transport> supplier = (s, v) -> new MockTcpTransport( |
| 273 | + final BiFunction<Settings, Version, Transport> supplier = (s, v) -> new MockNioTransport( |
272 | 274 | s, |
| 275 | + v, |
273 | 276 | threadPool, |
274 | | - BigArrays.NON_RECYCLING_INSTANCE, |
275 | | - new NoneCircuitBreakerService(), |
276 | | - new NamedWriteableRegistry(Collections.emptyList()), |
277 | 277 | networkService, |
278 | | - v) { |
| 278 | + PageCacheRecycler.NON_RECYCLING_INSTANCE, |
| 279 | + new NamedWriteableRegistry(Collections.emptyList()), |
| 280 | + new NoneCircuitBreakerService()) { |
279 | 281 | @Override |
280 | 282 | public TransportAddress[] addressesFromString(String address, int perAddressLimit) throws UnknownHostException { |
281 | 283 | final TransportAddress[] transportAddresses = addresses.get(address); |
@@ -634,14 +636,14 @@ public void testPingingTemporalPings() throws ExecutionException, InterruptedExc |
634 | 636 |
|
635 | 637 | NetworkService networkService = new NetworkService(Collections.emptyList()); |
636 | 638 |
|
637 | | - final BiFunction<Settings, Version, Transport> supplier = (s, v) -> new MockTcpTransport( |
| 639 | + final BiFunction<Settings, Version, Transport> supplier = (s, v) -> new MockNioTransport( |
638 | 640 | s, |
| 641 | + v, |
639 | 642 | threadPool, |
640 | | - BigArrays.NON_RECYCLING_INSTANCE, |
641 | | - new NoneCircuitBreakerService(), |
642 | | - new NamedWriteableRegistry(Collections.emptyList()), |
643 | 643 | networkService, |
644 | | - v); |
| 644 | + PageCacheRecycler.NON_RECYCLING_INSTANCE, |
| 645 | + new NamedWriteableRegistry(Collections.emptyList()), |
| 646 | + new NoneCircuitBreakerService()); |
645 | 647 |
|
646 | 648 | NetworkHandle handleA = startServices(settings, threadPool, "UZP_A", Version.CURRENT, supplier, EnumSet.allOf(Role.class)); |
647 | 649 | closeables.push(handleA.transportService); |
@@ -689,15 +691,14 @@ public void testPingingTemporalPings() throws ExecutionException, InterruptedExc |
689 | 691 |
|
690 | 692 | public void testInvalidHosts() throws InterruptedException { |
691 | 693 | final Logger logger = mock(Logger.class); |
692 | | - final NetworkService networkService = new NetworkService(Collections.emptyList()); |
693 | | - final Transport transport = new MockTcpTransport( |
| 694 | + final Transport transport = new MockNioTransport( |
694 | 695 | Settings.EMPTY, |
| 696 | + Version.CURRENT, |
695 | 697 | threadPool, |
696 | | - BigArrays.NON_RECYCLING_INSTANCE, |
697 | | - new NoneCircuitBreakerService(), |
| 698 | + new NetworkService(Collections.emptyList()), |
| 699 | + PageCacheRecycler.NON_RECYCLING_INSTANCE, |
698 | 700 | new NamedWriteableRegistry(Collections.emptyList()), |
699 | | - networkService, |
700 | | - Version.CURRENT) { |
| 701 | + new NoneCircuitBreakerService()) { |
701 | 702 | @Override |
702 | 703 | public BoundTransportAddress boundAddress() { |
703 | 704 | return new BoundTransportAddress( |
|
0 commit comments