@@ -116,7 +116,7 @@ public Session newSession( AccessMode mode )
116
116
{
117
117
if ( driver == null )
118
118
{
119
- driver = createDriver ( clusterRule .getCluster ().leader (). getRoutingUri () );
119
+ driver = createDriver ( clusterRule .getCluster ().getRoutingUri () );
120
120
}
121
121
122
122
return driver .session ( builder ().withDefaultAccessMode ( mode ).build () );
@@ -275,7 +275,7 @@ void shouldDropBrokenOldConnections() throws Exception
275
275
FakeClock clock = new FakeClock ();
276
276
ChannelTrackingDriverFactory driverFactory = new ChannelTrackingDriverFactory ( clock );
277
277
278
- URI routingUri = cluster .leader (). getRoutingUri ();
278
+ URI routingUri = cluster .getRoutingUri ();
279
279
AuthToken auth = clusterRule .getDefaultAuthToken ();
280
280
281
281
try ( Driver driver = driverFactory .newInstance ( routingUri , auth , RoutingSettings .DEFAULT , RetrySettings .DEFAULT , config , SecurityPlanImpl .insecure () ) )
@@ -335,10 +335,9 @@ void shouldAcceptMultipleBookmarks() throws Exception
335
335
String value = "Alice" ;
336
336
337
337
Cluster cluster = clusterRule .getCluster ();
338
- ClusterMember leader = cluster .leader ();
339
338
executor = newExecutor ();
340
339
341
- try ( Driver driver = createDriver ( leader .getRoutingUri () ) )
340
+ try ( Driver driver = createDriver ( cluster .getRoutingUri () ) )
342
341
{
343
342
List <Future <Bookmark >> futures = new ArrayList <>();
344
343
for ( int i = 0 ; i < threadCount ; i ++ )
@@ -367,16 +366,18 @@ void shouldAcceptMultipleBookmarks() throws Exception
367
366
void shouldNotReuseReadConnectionForWriteTransaction ()
368
367
{
369
368
Cluster cluster = clusterRule .getCluster ();
370
- ClusterMember leader = cluster .leader ();
371
369
372
- try ( Driver driver = createDriver ( leader .getRoutingUri () ) )
370
+ try ( Driver driver = createDriver ( cluster .getRoutingUri () ) )
373
371
{
374
372
AsyncSession session = driver .asyncSession ( builder ().withDefaultAccessMode ( AccessMode .READ ).build () );
375
373
376
374
CompletionStage <List <RecordAndSummary >> resultsStage = session .runAsync ( "RETURN 42" )
377
- .thenCompose ( cursor1 ->
378
- session .writeTransactionAsync ( tx -> tx .runAsync ( "CREATE (:Node1) RETURN 42" )
379
- .thenCompose ( cursor2 -> combineCursors ( cursor2 , cursor1 ) ) ) );
375
+ .thenCompose ( cursor1 ->
376
+ session .writeTransactionAsync (
377
+ tx -> tx .runAsync ( "CREATE (:Node1) RETURN 42" )
378
+ .thenCompose (
379
+ cursor2 -> combineCursors ( cursor2 ,
380
+ cursor1 ) ) ) );
380
381
381
382
List <RecordAndSummary > results = await ( resultsStage );
382
383
assertEquals ( 2 , results .size () );
@@ -405,15 +406,14 @@ void shouldNotReuseReadConnectionForWriteTransaction()
405
406
void shouldRespectMaxConnectionPoolSizePerClusterMember ()
406
407
{
407
408
Cluster cluster = clusterRule .getCluster ();
408
- ClusterMember leader = cluster .leader ();
409
409
410
410
Config config = Config .builder ()
411
411
.withMaxConnectionPoolSize ( 2 )
412
412
.withConnectionAcquisitionTimeout ( 42 , MILLISECONDS )
413
413
.withLogging ( DEV_NULL_LOGGING )
414
414
.build ();
415
415
416
- try ( Driver driver = createDriver ( leader .getRoutingUri (), config ) )
416
+ try ( Driver driver = createDriver ( cluster .getRoutingUri (), config ) )
417
417
{
418
418
String database = "neo4j" ;
419
419
Session writeSession1 =
@@ -443,11 +443,10 @@ void shouldRespectMaxConnectionPoolSizePerClusterMember()
443
443
void shouldAllowExistingTransactionToCompleteAfterDifferentConnectionBreaks ()
444
444
{
445
445
Cluster cluster = clusterRule .getCluster ();
446
- ClusterMember leader = cluster .leader ();
447
446
448
447
FailingConnectionDriverFactory driverFactory = new FailingConnectionDriverFactory ();
449
448
450
- try ( Driver driver = driverFactory .newInstance ( leader .getRoutingUri (), clusterRule .getDefaultAuthToken (),
449
+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
451
450
RoutingSettings .DEFAULT , RetrySettings .DEFAULT , configWithoutLogging (), SecurityPlanImpl .insecure () ) )
452
451
{
453
452
Session session1 = driver .session ();
@@ -486,10 +485,9 @@ RoutingSettings.DEFAULT, RetrySettings.DEFAULT, configWithoutLogging(), Security
486
485
void shouldRediscoverWhenConnectionsToAllCoresBreak ()
487
486
{
488
487
Cluster cluster = clusterRule .getCluster ();
489
- ClusterMember leader = cluster .leader ();
490
488
491
489
ChannelTrackingDriverFactory driverFactory = new ChannelTrackingDriverFactory ();
492
- try ( Driver driver = driverFactory .newInstance ( leader .getRoutingUri (), clusterRule .getDefaultAuthToken (),
490
+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
493
491
RoutingSettings .DEFAULT , RetrySettings .DEFAULT , configWithoutLogging (), SecurityPlanImpl .insecure () ) )
494
492
{
495
493
String database = "neo4j" ;
@@ -556,7 +554,7 @@ void shouldKeepOperatingWhenConnectionsBreak() throws Exception
556
554
.withMaxTransactionRetryTime ( testRunTimeMs , MILLISECONDS )
557
555
.build ();
558
556
559
- try ( Driver driver = driverFactory .newInstance ( cluster .leader (). getRoutingUri (), clusterRule .getDefaultAuthToken (),
557
+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
560
558
RoutingSettings .DEFAULT , RetrySettings .DEFAULT , config , SecurityPlanImpl .insecure () ) )
561
559
{
562
560
List <Future <?>> results = new ArrayList <>();
0 commit comments