Skip to content

Commit 531fca7

Browse files
author
chengyitian
committed
Merge branch 'dev' of dolphindb.net:dolphindb/api-java
2 parents 8676f72 + 2b8772b commit 531fca7

File tree

5 files changed

+78
-36
lines changed

5 files changed

+78
-36
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.dolphindb</groupId>
44
<artifactId>dolphindb-javaapi</artifactId>
5-
<version>3.00.1.1</version>
5+
<version>3.00.1.2</version>
66
<packaging>jar</packaging>
77

88
<properties>
9-
<dolphindb.version>3.00.1.1</dolphindb.version>
9+
<dolphindb.version>3.00.1.2</dolphindb.version>
1010
</properties>
1111
<name>DolphinDB Java API</name>
1212
<description>The messaging and data conversion protocol between Java and DolphinDB server</description>
@@ -31,7 +31,7 @@
3131
<connection>scm:git:git@github.com:dolphindb/api-java.git</connection>
3232
<developerConnection>scm:git:git@github.com:dolphindb/api-java.git</developerConnection>
3333
<url>git@github.com:dolphindb/api-java.git</url>
34-
<tag>api-java-3.00.1.1</tag>
34+
<tag>api-java-3.00.1.2</tag>
3535
</scm>
3636
<dependencies>
3737
<dependency>

src/com/xxdb/DBConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class DBConnection {
3939
private static final int MAX_FORM_VALUE = Entity.DATA_FORM.values().length - 1;
4040
private static final int MAX_TYPE_VALUE = Entity.DATA_TYPE.DT_DECIMAL128_ARRAY.getValue();
4141
private static final int DEFAULT_PRIORITY = 4;
42-
private static final int DEFAULT_PARALLELISM = 2;
42+
private static final int DEFAULT_PARALLELISM = 64;
4343

4444
private ReentrantLock mutex_;
4545
private DBConnectionImpl conn_;

src/com/xxdb/data/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public class Utils {
1717

18-
public static final String JAVA_API_VERSION = "3.00.1.1";
18+
public static final String JAVA_API_VERSION = "3.00.1.2";
1919

2020
public static final int DISPLAY_ROWS = 20;
2121
public static final int DISPLAY_COLS = 100;

test/com/xxdb/DBConnectionTest.java

Lines changed: 72 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import static com.xxdb.Prepare.*;
3030
import static com.xxdb.comm.SqlStdEnum.*;
31+
import static java.lang.Thread.sleep;
3132
import static org.junit.Assert.*;
3233

3334
public class DBConnectionTest {
@@ -2544,7 +2545,7 @@ public void TestPartitionTable() throws IOException, InterruptedException {
25442545
sb.append("pt.append!(t1);");
25452546
conn.run(sb.toString());
25462547
conn.run("pnodeRun(purgeCacheEngine)");
2547-
Thread.sleep(5000);
2548+
sleep(5000);
25482549
BasicLong res_x = (BasicLong) conn.run("exec count(*) from pt where x=1");
25492550
assertEquals(true, res_x.getLong() > 0);
25502551
//PartitionTableJoin
@@ -2636,10 +2637,10 @@ public void TestCloseOnce() throws IOException, InterruptedException {
26362637
DBConnection connClose = new DBConnection();
26372638
//连接一次
26382639
connClose.connect(HOST, PORT, "admin", "123456");
2639-
Thread.sleep(5000);
2640+
sleep(5000);
26402641
int connCount = getConnCount();
26412642
connClose.close();
2642-
Thread.sleep(5000);
2643+
sleep(5000);
26432644
int connCount1 = getConnCount();
26442645
assertEquals(connCount - 1, connCount1);
26452646
}
@@ -2658,10 +2659,10 @@ public void TestClose() throws IOException, InterruptedException {
26582659
}
26592660

26602661
}
2661-
Thread.sleep(2000);
2662+
sleep(2000);
26622663
int connCount = getConnCount();
26632664
connNew.close();
2664-
Thread.sleep(2000);
2665+
sleep(2000);
26652666
int connCount1 = getConnCount();
26662667
assertEquals(connCount - 1, connCount1);
26672668
}
@@ -3457,7 +3458,7 @@ public void run() {
34573458
Timer timer = new Timer("Timer");
34583459
TimerTask rec = new reconnect();
34593460
timer.scheduleAtFixedRate(rec, 0L, 500L);
3460-
Thread.sleep(500L);
3461+
sleep(500L);
34613462
timer.cancel();
34623463
}
34633464

@@ -3553,7 +3554,7 @@ public void test_TryRun_fetchSize() throws IOException, InterruptedException {
35533554
conn.tryRun("x;",1,1,8192,true);
35543555
long afterDT = System.currentTimeMillis();
35553556
System.out.println(afterDT-beforeDT);
3556-
Thread.sleep(5000);
3557+
sleep(5000);
35573558
conn.run("y=1..10000000");
35583559
long startDT = System.currentTimeMillis();
35593560
conn.tryRun("y;",1,1,1000000,true);
@@ -3686,7 +3687,7 @@ public void test_TryRun_args_fetchSize() throws IOException, InterruptedExceptio
36863687
conn.tryRun("sum",argus1,1,1,8192);
36873688
long afterDT = System.currentTimeMillis();
36883689
System.out.println(afterDT-beforeDT);
3689-
Thread.sleep(10000);
3690+
sleep(10000);
36903691
List<Entity> argus2 = new ArrayList<>();
36913692
conn.run("y=1..10000000");
36923693
argus2.add(conn.run("y;"));
@@ -4289,7 +4290,7 @@ public void test_insert_into_decimal128_arrayvector() throws Exception {
42894290
public void TestConnectWithoutUserid() throws IOException, InterruptedException {
42904291
DBConnection conn = new DBConnection();
42914292
conn.connect(HOST,PORT);
4292-
Thread.sleep(500);
4293+
sleep(500);
42934294
assertEquals(true, conn.isConnected());
42944295
}
42954296
@Test
@@ -4308,7 +4309,7 @@ public void Test_connect_EnableHighAvailability_false() throws IOException, Inte
43084309
}
43094310
//DBConnection conn1 = new DBConnection();
43104311
conn1.connect(HOST,PORT,"admin","123456",null,false);
4311-
Thread.sleep(500);
4312+
sleep(500);
43124313
String e = null;
43134314
try{
43144315
conn1.run("a=1;\n a");
@@ -4318,14 +4319,14 @@ public void Test_connect_EnableHighAvailability_false() throws IOException, Inte
43184319
System.out.println(ex);
43194320
}
43204321
assertNotNull(e);
4321-
Thread.sleep(1000);
4322+
sleep(1000);
43224323
try{
43234324
conn.run("startDataNode(\""+nodeAlias+"\")");
43244325
}catch(Exception ex)
43254326
{
43264327
System.out.println(ex);
43274328
}
4328-
Thread.sleep(1000);
4329+
sleep(1000);
43294330
conn1.connect(HOST,PORT,"admin","123456",null,false);
43304331
conn1.run("a=1;\n a");
43314332
assertEquals(true, conn1.isConnected());
@@ -4345,7 +4346,7 @@ public void Test_connect_EnableHighAvailability_true() throws IOException, Inter
43454346
{
43464347
System.out.println(ex);
43474348
}
4348-
Thread.sleep(1000);
4349+
sleep(1000);
43494350
conn1.run("a=1;\n a");
43504351
//The connection switches to a different node to execute the code
43514352
try{
@@ -4354,7 +4355,7 @@ public void Test_connect_EnableHighAvailability_true() throws IOException, Inter
43544355
{
43554356
System.out.println(ex);
43564357
}
4357-
Thread.sleep(1000);
4358+
sleep(1000);
43584359
assertEquals(true, conn1.isConnected());
43594360
}
43604361
//@Test //AJ-287
@@ -4393,7 +4394,7 @@ public void Test_connect_EnableHighAvailability_true_1() throws IOException, Int
43934394
{
43944395
System.out.println(ex);
43954396
}
4396-
Thread.sleep(1000);
4397+
sleep(1000);
43974398
conn1.run("a=1;\n a");
43984399
//The connection switches to a different node to execute the code
43994400
try{
@@ -4402,7 +4403,7 @@ public void Test_connect_EnableHighAvailability_true_1() throws IOException, Int
44024403
{
44034404
System.out.println(ex);
44044405
}
4405-
Thread.sleep(1000);
4406+
sleep(1000);
44064407
assertEquals(true, conn1.isConnected());
44074408
}
44084409
@Test
@@ -4417,7 +4418,7 @@ public void Test_reConnect__true() throws IOException, InterruptedException {
44174418
{
44184419
System.out.println(ex);
44194420
}
4420-
Thread.sleep(1000);
4421+
sleep(1000);
44214422
conn1.run("a=1;\n a");
44224423
//The connection switches to a different node to execute the code
44234424
try{
@@ -4426,7 +4427,7 @@ public void Test_reConnect__true() throws IOException, InterruptedException {
44264427
{
44274428
System.out.println(ex);
44284429
}
4429-
Thread.sleep(1000);
4430+
sleep(1000);
44304431
assertEquals(true, conn1.isConnected());
44314432
}
44324433
@Test //reConnect is not valid
@@ -4441,7 +4442,7 @@ public void Test_reConnect__false() throws IOException, InterruptedException {
44414442
{
44424443
System.out.println(ex);
44434444
}
4444-
Thread.sleep(1000);
4445+
sleep(1000);
44454446
conn1.run("a=1;\n a");
44464447
//The connection switches to a different node to execute the code
44474448
try{
@@ -4450,7 +4451,7 @@ public void Test_reConnect__false() throws IOException, InterruptedException {
44504451
{
44514452
System.out.println(ex);
44524453
}
4453-
Thread.sleep(1000);
4454+
sleep(1000);
44544455
assertEquals(true, conn1.isConnected());
44554456
}
44564457
//@Test
@@ -4492,7 +4493,7 @@ public void test_BasicDBTask1223()throws Exception{
44924493
public void Test_Connect_SqlStdEnum_DolphinDB() throws IOException, InterruptedException {
44934494
DBConnection conn = new DBConnection(DolphinDB);
44944495
conn.connect(HOST,PORT);
4495-
Thread.sleep(500);
4496+
sleep(500);
44964497
assertEquals(true, conn.isConnected());
44974498
BasicDoubleVector ba = (BasicDoubleVector)conn.run("cumavg(1 2 3);");
44984499
System.out.println(ba.getString());
@@ -4510,7 +4511,7 @@ public void Test_Connect_SqlStdEnum_DolphinDB() throws IOException, InterruptedE
45104511
public void Test_Connect_SqlStdEnum_DolphinDB_1() throws IOException, InterruptedException {
45114512
DBConnection conn = new DBConnection();
45124513
conn.connect(HOST,PORT);
4513-
Thread.sleep(500);
4514+
sleep(500);
45144515
assertEquals(true, conn.isConnected());
45154516
BasicDoubleVector ba = (BasicDoubleVector)conn.run("runSQL(\"cumavg(1 2 3)\", 'ddb')");
45164517
System.out.println(ba.getString());
@@ -4528,7 +4529,7 @@ public void Test_Connect_SqlStdEnum_DolphinDB_1() throws IOException, Interrupte
45284529
public void Test_Connect_SqlStdEnum_DolphinDB_2() throws IOException, InterruptedException {
45294530
DBConnection conn = new DBConnection(DolphinDB);
45304531
conn.connect(HOST,PORT);
4531-
Thread.sleep(500);
4532+
sleep(500);
45324533
assertEquals(true, conn.isConnected());
45334534
BasicDoubleVector ba = (BasicDoubleVector)conn.run("runSQL(\"cumavg(1 2 3)\", 'ddb')");
45344535
System.out.println(ba.getString());
@@ -4567,7 +4568,7 @@ public void Test_Connect_SqlStdEnum_Oracle() throws IOException, InterruptedExce
45674568
DBConnection conn = new DBConnection(Oracle);
45684569
conn.connect(HOST,PORT);
45694570
conn.connect(HOST,PORT);
4570-
Thread.sleep(500);
4571+
sleep(500);
45714572
assertEquals(true, conn.isConnected());
45724573
BasicDoubleVector ba = (BasicDoubleVector)conn.run("cumavg(1 2 3);");
45734574
System.out.println(ba.getString());
@@ -4589,7 +4590,7 @@ public void Test_Connect_SqlStdEnum_Oracle_1() throws IOException, InterruptedEx
45894590
DBConnection conn = new DBConnection();
45904591
conn.connect(HOST,PORT);
45914592
conn.connect(HOST,PORT);
4592-
Thread.sleep(500);
4593+
sleep(500);
45934594
assertEquals(true, conn.isConnected());
45944595
BasicDoubleVector ba = (BasicDoubleVector)conn.run("runSQL(\"cumavg(1 2 3)\", 'oracle');");
45954596
System.out.println(ba.getString());
@@ -4611,7 +4612,7 @@ public void Test_Connect_SqlStdEnum_Oracle_2() throws IOException, InterruptedEx
46114612
DBConnection conn = new DBConnection(Oracle);
46124613
conn.connect(HOST,PORT);
46134614
conn.connect(HOST,PORT);
4614-
Thread.sleep(500);
4615+
sleep(500);
46154616
assertEquals(true, conn.isConnected());
46164617
BasicDoubleVector ba = (BasicDoubleVector)conn.run("runSQL(\"cumavg(1 2 3)\", 'ddb');");
46174618
System.out.println(ba.getString());
@@ -4632,7 +4633,7 @@ public void Test_Connect_SqlStdEnum_Oracle_2() throws IOException, InterruptedEx
46324633
public void Test_Connect_SqlStdEnum_MySQL() throws IOException, InterruptedException {
46334634
DBConnection conn = new DBConnection(MySQL);
46344635
conn.connect(HOST,PORT);
4635-
Thread.sleep(500);
4636+
sleep(500);
46364637
assertEquals(true, conn.isConnected());
46374638
BasicDoubleVector ba = (BasicDoubleVector)conn.run("cumavg(1 2 3);");
46384639
System.out.println(ba.getString());
@@ -4658,7 +4659,7 @@ public void Test_Connect_SqlStdEnum_MySQL() throws IOException, InterruptedExcep
46584659
public void Test_Connect_SqlStdEnum_MySQL_1() throws IOException, InterruptedException {
46594660
DBConnection conn = new DBConnection();
46604661
conn.connect(HOST,PORT);
4661-
Thread.sleep(500);
4662+
sleep(500);
46624663
assertEquals(true, conn.isConnected());
46634664
BasicDoubleVector ba = (BasicDoubleVector)conn.run("runSQL(\"cumavg(1 2 3)\", 'mysql');");
46644665
System.out.println(ba.getString());
@@ -4685,7 +4686,7 @@ public void Test_Connect_SqlStdEnum_MySQL_2() throws IOException, InterruptedExc
46854686
DBConnection conn = new DBConnection(MySQL);
46864687
conn.connect(HOST,PORT);
46874688
conn.connect(HOST,PORT);
4688-
Thread.sleep(500);
4689+
sleep(500);
46894690
assertEquals(true, conn.isConnected());
46904691
BasicDoubleVector ba = (BasicDoubleVector)conn.run("runSQL(\"cumavg(1 2 3)\", 'ddb');");
46914692
System.out.println(ba.getString());
@@ -4717,7 +4718,7 @@ public void Test_Connect_SqlStdEnum_getByName() throws IOException, InterruptedE
47174718
DBConnection conn = new DBConnection( getByName("MySQL"));
47184719
conn.connect(HOST,PORT);
47194720
conn.connect(HOST,PORT);
4720-
Thread.sleep(500);
4721+
sleep(500);
47214722
assertEquals(true, conn.isConnected());
47224723
BasicDoubleVector ba = (BasicDoubleVector)conn.run("runSQL(\"cumavg(1 2 3)\", 'ddb');");
47234724
System.out.println(ba.getString());
@@ -5092,4 +5093,45 @@ public void test_allDateType_array_combine() throws IOException {
50925093
// thread1.start();
50935094
// thread.join();
50945095
// }
5096+
5097+
@Test//api设置的parallelism小于server的setMaxJobParallelism
5098+
public void test_DBConnection_run_parallelism_1() throws IOException {
5099+
PrepareUser("parallelism_test","123456");
5100+
conn = new DBConnection();
5101+
conn.connect(HOST,PORT,"parallelism_test","123456");
5102+
conn.run("setMaxJobParallelism(\"parallelism_test\",22);",4,5,false);
5103+
5104+
DBConnection conn1 = new DBConnection();
5105+
conn1.connect(HOST,PORT,"parallelism_test","123456");
5106+
BasicTable re1 = (BasicTable)conn.run("getConsoleJobs();",4,5,false);
5107+
Assert.assertEquals("5",re1.getColumn(6).get(0).getString());
5108+
}
5109+
@Test//api设置的parallelism大于server的setMaxJobParallelism
5110+
public void test_DBConnection_run_parallelism_2() throws IOException {
5111+
PrepareUser("parallelism_test","123456");
5112+
conn = new DBConnection();
5113+
conn.connect(HOST,PORT,"parallelism_test","123456");
5114+
conn.run("setMaxJobParallelism(\"parallelism_test\",22);",4,30,false);
5115+
5116+
DBConnection conn1 = new DBConnection();
5117+
conn1.connect(HOST,PORT,"parallelism_test","123456");
5118+
BasicTable re1 = (BasicTable)conn1.run("getConsoleJobs();",5,30,false);
5119+
Assert.assertEquals("22",re1.getColumn(6).get(0).getString());
5120+
}
5121+
5122+
@Test//api没有设置parallelism,取默认值64,大于server的setMaxJobParallelism
5123+
public void test_DBConnection_run_parallelism_3() throws IOException, InterruptedException {
5124+
DBConnection conn = new DBConnection();
5125+
PrepareUser("parallelism_test","123456");
5126+
conn.connect(HOST,PORT,"parallelism_test","123456");
5127+
conn.run("setMaxJobParallelism(\"parallelism_test\",22);");
5128+
BasicTable re = (BasicTable)conn.run("getConsoleJobs();");
5129+
System.out.println(re.getString());
5130+
5131+
DBConnection conn1 = new DBConnection();
5132+
conn1.connect(HOST,PORT,"parallelism_test","123456");
5133+
BasicTable re1 = (BasicTable)conn1.run("getConsoleJobs();");
5134+
System.out.println(re1.getString());
5135+
Assert.assertEquals("22",re1.getColumn(6).get(0).getString());
5136+
}
50955137
}

test/com/xxdb/Prepare.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public static void PrepareStreamTableDecimal_array(String dataType, int scale) t
272272
public static void PrepareUser(String userName,String password) throws IOException {
273273
DBConnection conn = new DBConnection();
274274
conn.connect(HOST,PORT,"admin","123456");
275-
conn.run("def create_user(){try{deleteUser(`"+userName+")}catch(ex){};createUser(`"+userName+", '"+password+"');};"+
275+
conn.run("def create_user(){try{deleteUser(`"+userName+")}catch(ex){};createUser(`"+userName+", '"+password+"',,true);};"+
276276
"rpc(getControllerAlias(),create_user);" );
277277
}
278278

0 commit comments

Comments
 (0)