From 99ef14af98e77378b5be239d65036d14e8c3e069 Mon Sep 17 00:00:00 2001 From: zyyang Date: Wed, 27 Jan 2021 15:12:48 +0800 Subject: [PATCH] change --- .../taosdata/example/ConnectionPoolDemo.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/example/ConnectionPoolDemo.java b/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/example/ConnectionPoolDemo.java index 3b288b38dc..183f7345ca 100644 --- a/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/example/ConnectionPoolDemo.java +++ b/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/example/ConnectionPoolDemo.java @@ -20,13 +20,14 @@ public class ConnectionPoolDemo { private static Logger logger = Logger.getLogger(DruidPoolBuilder.class); private static final String dbName = "pool_test"; + private static String poolType = "hikari"; private static long totalSize = 1_000_000l; - private static int batchSize = 10; - private static int sleep = 1000; + private static long tableSize = 1; + private static long batchSize = 1; + private static int poolSize = 50; - private static int tableSize = 1000; private static int threadCount = 50; - private static String poolType = "hikari"; + private static int sleep = 1000; public static void main(String[] args) { @@ -35,16 +36,26 @@ public class ConnectionPoolDemo { if ("-host".equalsIgnoreCase(args[i]) && i < args.length - 1) { host = args[++i]; } + if ("-poolType".equalsIgnoreCase(args[i]) && i < args.length - 1) { + poolType = args[++i]; + } if ("-recordNumber".equalsIgnoreCase(args[i]) && i < args.length - 1) { totalSize = Long.parseLong(args[++i]); } - if ("-poolType".equalsIgnoreCase(args[i]) && i < args.length - 1) { - poolType = args[++i]; + if ("-tableNumber".equalsIgnoreCase(args[i]) && i < args.length - 1) { + tableSize = Long.parseLong(args[++i]); + } + if ("-batchNumber".equalsIgnoreCase(args[i]) && i < args.length - 1) { + batchSize = Long.parseLong(args[++i]); } } if (host == null) { - System.out.println("Usage: java -jar XXX.jar -host -recordNumber -poolType "); + System.out.println("Usage: java -jar XXX.jar -host " + + "-recordNumber " + + "-tableNumber " + + "-batchNumber " + + "-poolType "); return; } @@ -83,7 +94,7 @@ public class ConnectionPoolDemo { // } ExecutorService executor = Executors.newFixedThreadPool(threadCount); - for (long i = 0; i < totalSize / batchSize / tableSize; i++) { + for (long i = 0; i < totalSize / tableSize / batchSize; i++) { executor.execute(new InsertTask(dataSource, dbName, tableSize, batchSize)); // sleep few seconds try { -- GitLab