@@ -93,8 +93,7 @@ public void ensureRoutingShouldUpdateRoutingTableAndPurgeConnectionPoolWhenStale
93
93
when ( routingTable .update ( any ( ClusterComposition .class ) ) ).thenReturn ( set );
94
94
95
95
// when
96
- LoadBalancer balancer = new LoadBalancer ( conns , routingTable , rediscovery , DEV_NULL_LOGGER ,
97
- new LeastConnectedLoadBalancingStrategy ( conns ) );
96
+ LoadBalancer balancer = new LoadBalancer ( conns , routingTable , rediscovery , DEV_NULL_LOGGER );
98
97
99
98
// then
100
99
assertNotNull ( balancer );
@@ -110,8 +109,7 @@ public void shouldRefreshRoutingTableOnInitialization() throws Exception
110
109
// given & when
111
110
final AtomicInteger refreshRoutingTableCounter = new AtomicInteger ( 0 );
112
111
LoadBalancer balancer = new LoadBalancer ( mock ( ConnectionPool .class ), mock ( RoutingTable .class ),
113
- mock ( Rediscovery .class ), DEV_NULL_LOGGER ,
114
- new LeastConnectedLoadBalancingStrategy ( mock ( ConnectionPool .class ) ) )
112
+ mock ( Rediscovery .class ), DEV_NULL_LOGGER )
115
113
{
116
114
@ Override
117
115
synchronized void refreshRoutingTable ()
@@ -165,8 +163,7 @@ public void shouldForgetAddressAndItsConnectionsOnServiceUnavailableWhileClosing
165
163
RoutingTable routingTable = mock ( RoutingTable .class );
166
164
ConnectionPool connectionPool = mock ( ConnectionPool .class );
167
165
Rediscovery rediscovery = mock ( Rediscovery .class );
168
- LoadBalancer loadBalancer = new LoadBalancer ( connectionPool , routingTable , rediscovery , DEV_NULL_LOGGER ,
169
- new LeastConnectedLoadBalancingStrategy ( connectionPool ) );
166
+ LoadBalancer loadBalancer = new LoadBalancer ( connectionPool , routingTable , rediscovery , DEV_NULL_LOGGER );
170
167
BoltServerAddress address = new BoltServerAddress ( "host" , 42 );
171
168
172
169
PooledConnection connection = newConnectionWithFailingSync ( address );
@@ -200,8 +197,7 @@ public void shouldForgetAddressAndItsConnectionsOnServiceUnavailableWhileClosing
200
197
PooledConnection connectionWithFailingSync = newConnectionWithFailingSync ( address );
201
198
when ( connectionPool .acquire ( any ( BoltServerAddress .class ) ) ).thenReturn ( connectionWithFailingSync );
202
199
Rediscovery rediscovery = mock ( Rediscovery .class );
203
- LoadBalancer loadBalancer = new LoadBalancer ( connectionPool , routingTable , rediscovery , DEV_NULL_LOGGER ,
204
- new LeastConnectedLoadBalancingStrategy ( connectionPool ) );
200
+ LoadBalancer loadBalancer = new LoadBalancer ( connectionPool , routingTable , rediscovery , DEV_NULL_LOGGER );
205
201
206
202
Session session = newSession ( loadBalancer );
207
203
// begin transaction to make session obtain a connection
@@ -247,8 +243,7 @@ public void shouldThrowWhenRediscoveryReturnsNoSuitableServers()
247
243
when ( routingTable .readers () ).thenReturn ( new AddressSet () );
248
244
when ( routingTable .writers () ).thenReturn ( new AddressSet () );
249
245
250
- LoadBalancer loadBalancer = new LoadBalancer ( connections , routingTable , rediscovery , DEV_NULL_LOGGER ,
251
- new LeastConnectedLoadBalancingStrategy ( connections ) );
246
+ LoadBalancer loadBalancer = new LoadBalancer ( connections , routingTable , rediscovery , DEV_NULL_LOGGER );
252
247
253
248
try
254
249
{
@@ -288,8 +283,7 @@ public void shouldSelectLeastConnectedAddress()
288
283
289
284
Rediscovery rediscovery = mock ( Rediscovery .class );
290
285
291
- LoadBalancer loadBalancer = new LoadBalancer ( connectionPool , routingTable , rediscovery , DEV_NULL_LOGGER ,
292
- new LeastConnectedLoadBalancingStrategy ( connectionPool ) );
286
+ LoadBalancer loadBalancer = new LoadBalancer ( connectionPool , routingTable , rediscovery , DEV_NULL_LOGGER );
293
287
294
288
Set <BoltServerAddress > seenAddresses = new HashSet <>();
295
289
for ( int i = 0 ; i < 10 ; i ++ )
@@ -315,8 +309,7 @@ public void shouldRoundRobinWhenNoActiveConnections()
315
309
316
310
Rediscovery rediscovery = mock ( Rediscovery .class );
317
311
318
- LoadBalancer loadBalancer = new LoadBalancer ( connectionPool , routingTable , rediscovery , DEV_NULL_LOGGER ,
319
- new LeastConnectedLoadBalancingStrategy ( connectionPool ) );
312
+ LoadBalancer loadBalancer = new LoadBalancer ( connectionPool , routingTable , rediscovery , DEV_NULL_LOGGER );
320
313
321
314
Set <BoltServerAddress > seenAddresses = new HashSet <>();
322
315
for ( int i = 0 ; i < 10 ; i ++ )
@@ -337,8 +330,7 @@ private void testRediscoveryWhenStale( AccessMode mode )
337
330
RoutingTable routingTable = newStaleRoutingTableMock ( mode );
338
331
Rediscovery rediscovery = newRediscoveryMock ();
339
332
340
- LoadBalancer loadBalancer = new LoadBalancer ( connections , routingTable , rediscovery , DEV_NULL_LOGGER ,
341
- new LeastConnectedLoadBalancingStrategy ( connections ) );
333
+ LoadBalancer loadBalancer = new LoadBalancer ( connections , routingTable , rediscovery , DEV_NULL_LOGGER );
342
334
verify ( rediscovery ).lookupClusterComposition ( routingTable , connections );
343
335
344
336
assertNotNull ( loadBalancer .acquireConnection ( mode ) );
@@ -354,8 +346,7 @@ private void testNoRediscoveryWhenNotStale( AccessMode staleMode, AccessMode not
354
346
RoutingTable routingTable = newStaleRoutingTableMock ( staleMode );
355
347
Rediscovery rediscovery = newRediscoveryMock ();
356
348
357
- LoadBalancer loadBalancer = new LoadBalancer ( connections , routingTable , rediscovery , DEV_NULL_LOGGER ,
358
- new LeastConnectedLoadBalancingStrategy ( connections ) );
349
+ LoadBalancer loadBalancer = new LoadBalancer ( connections , routingTable , rediscovery , DEV_NULL_LOGGER );
359
350
verify ( rediscovery ).lookupClusterComposition ( routingTable , connections );
360
351
361
352
assertNotNull ( loadBalancer .acquireConnection ( notStaleMode ) );
@@ -388,8 +379,7 @@ private LoadBalancer setupLoadBalancer( PooledConnection writerConn, PooledConne
388
379
when ( routingTable .readers () ).thenReturn ( readerAddrs );
389
380
when ( routingTable .writers () ).thenReturn ( writerAddrs );
390
381
391
- return new LoadBalancer ( connPool , routingTable , rediscovery , DEV_NULL_LOGGER ,
392
- new LeastConnectedLoadBalancingStrategy ( connPool ) );
382
+ return new LoadBalancer ( connPool , routingTable , rediscovery , DEV_NULL_LOGGER );
393
383
}
394
384
395
385
private static Session newSession ( LoadBalancer loadBalancer )
0 commit comments