change
This commit is contained in:
parent
45a0bf5c15
commit
9ed2f88bbc
|
@ -64,31 +64,31 @@ public class ConnectionPoolDemo {
|
||||||
logger.info(">>>>>>>>>>>>>> connection pool Type: " + poolType);
|
logger.info(">>>>>>>>>>>>>> connection pool Type: " + poolType);
|
||||||
init(dataSource);
|
init(dataSource);
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// Connection connection = dataSource.getConnection();
|
Connection connection = dataSource.getConnection();
|
||||||
// Statement statement = connection.createStatement();
|
Statement statement = connection.createStatement();
|
||||||
// String sql = "insert into " + dbName + ".t_1 values('2020-01-01 00:00:00.000',12.12,111)";
|
String sql = "insert into " + dbName + ".t_1 values('2020-01-01 00:00:00.000',12.12,111)";
|
||||||
// int affectRows = statement.executeUpdate(sql);
|
int affectRows = statement.executeUpdate(sql);
|
||||||
// System.out.println("affectRows >>> " + affectRows);
|
System.out.println("affectRows >>> " + affectRows);
|
||||||
// affectRows = statement.executeUpdate(sql);
|
affectRows = statement.executeUpdate(sql);
|
||||||
// System.out.println("affectRows >>> " + affectRows);
|
System.out.println("affectRows >>> " + affectRows);
|
||||||
// statement.close();
|
statement.close();
|
||||||
// connection.close();
|
connection.close();
|
||||||
// } catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
// }
|
|
||||||
|
|
||||||
ExecutorService executor = Executors.newFixedThreadPool(threadCount);
|
|
||||||
for (long i = 0; i < totalSize / batchSize / tableSize; i++) {
|
|
||||||
executor.execute(new InsertTask(dataSource, dbName, tableSize, batchSize));
|
|
||||||
// sleep few seconds
|
|
||||||
try {
|
|
||||||
TimeUnit.MILLISECONDS.sleep(sleep);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
executor.shutdown();
|
|
||||||
|
// ExecutorService executor = Executors.newFixedThreadPool(threadCount);
|
||||||
|
// for (long i = 0; i < totalSize / batchSize / tableSize; i++) {
|
||||||
|
// executor.execute(new InsertTask(dataSource, dbName, tableSize, batchSize));
|
||||||
|
// // sleep few seconds
|
||||||
|
// try {
|
||||||
|
// TimeUnit.MILLISECONDS.sleep(sleep);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// executor.shutdown();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue