Mercurial > hg > monetdb-java
comparison tests/Test_Csendthread.java @ 0:a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Wed, 21 Sep 2016 09:34:48 +0200 (2016-09-21) |
parents | |
children | 04fbf3655452 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a5a898f6886c |
---|---|
1 /* | |
2 * This Source Code Form is subject to the terms of the Mozilla Public | |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
5 * | |
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V. | |
7 */ | |
8 | |
9 import java.sql.*; | |
10 | |
11 public class Test_Csendthread { | |
12 public static void main(String[] args) throws Exception { | |
13 Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); | |
14 | |
15 System.out.println("0. active threads: " + Thread.activeCount()); | |
16 | |
17 StringBuilder sb = new StringBuilder(); | |
18 sb.append("SELECT 1"); | |
19 for (int i = 0; i < 256; i++) { | |
20 sb.append("-- ADDING DUMMY TEXT AS COMMENT TO MAKE THE QUERY VERY VERY VERY VERY LONG\n"); | |
21 } | |
22 sb.append(";\n"); | |
23 String longQuery = sb.toString(); | |
24 | |
25 for (int i = 0; i < 10; i++) { | |
26 for (int j = 0; j < 10; j++) { | |
27 Connection conn = DriverManager.getConnection(args[0]); | |
28 try { | |
29 Statement st = conn.createStatement(); | |
30 st.execute(longQuery); | |
31 st.close(); | |
32 } finally { | |
33 conn.close(); | |
34 } | |
35 } | |
36 System.out.println("1. active threads: " + Thread.activeCount()); | |
37 } | |
38 System.out.println("2. active threads: " + Thread.activeCount()); | |
39 } | |
40 } |