@@ -415,6 +415,9 @@ public void Test_getConnection_enableHighAvailability_true_enableLoadBalance_fal
415
415
DBConnection connection = new DBConnection ();
416
416
connection .connect (HOST , PORT , "admin" , "123456" ,null ,true ,null ,false ,false );
417
417
list .add (connection );
418
+ // BasicInt re = (BasicInt)connection.run("getNodePort()");
419
+ // System.out.println("current node is:"+re);
420
+ // System.out.println("stop current node");
418
421
}
419
422
DBConnection connection1 = new DBConnection ();
420
423
connection1 .connect (HOST , PORT , "admin" , "123456" ,false );
@@ -579,6 +582,45 @@ public void Test_DBConnectionPool_enableHighAvailability_true_loadBalance_false_
579
582
}
580
583
}
581
584
}
585
+ //@Test//The current node is unavailable
586
+ public void Test_DBConnectionPool_enableHighAvailability_true_loadBalance_false_2 () throws SQLException , ClassNotFoundException , IOException , InterruptedException {
587
+ DBConnection controller_conn = new DBConnection ();
588
+ controller_conn .connect (controller_host , controller_port , "admin" , "123456" );
589
+ class MyThread extends Thread {
590
+ @ Override
591
+ public void run () {
592
+ try {
593
+ DBConnectionPool pool1 = new ExclusiveDBConnectionPool (HOST ,PORT ,"admin" ,"123456" ,100 ,false ,true ,null ,null , false , false , false );
594
+ Thread .sleep (1000 );
595
+ } catch (IOException e ) {
596
+ throw new RuntimeException (e );
597
+ } catch (InterruptedException e ) {
598
+ throw new RuntimeException (e );
599
+ }
600
+ }
601
+ }
602
+ class MyThread1 extends Thread {
603
+ @ Override
604
+ public void run () {
605
+ try {
606
+ controller_conn .run ("try{stopDataNode('" +HOST +":" +PORT +"')}catch(ex){}" );
607
+ Thread .sleep (1000 );
608
+ } catch (Exception e ) {
609
+ // 捕获异常并打印错误信息
610
+ System .err .println ("Error executing task: " + e .getMessage ());
611
+ }
612
+ }
613
+ }
614
+ MyThread thread = new MyThread ();
615
+ MyThread1 thread1 = new MyThread1 ();
616
+ thread .start ();
617
+ Thread .sleep (15 );
618
+ System .err .println ("thread1开始运行 " );
619
+ thread1 .start ();
620
+ thread .join ();
621
+ thread1 .join ();
622
+ controller_conn .run ("try{stopDataNode('" +HOST +":" +PORT +"')}catch(ex){}" );
623
+ }
582
624
@ Test
583
625
public void Test_DBConnectionPool_enableHighAvailability_true_loadBalance_true_highAvailabilitySites_null () throws SQLException , ClassNotFoundException , IOException {
584
626
DBConnectionPool pool1 = new ExclusiveDBConnectionPool (HOST ,PORT ,"admin" ,"123456" ,100 ,true ,true ,null ,null , false , false , false );
0 commit comments