db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1330197 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleThread.java
Date Wed, 25 Apr 2012 11:19:19 GMT
Author: kahatlen
Date: Wed Apr 25 11:19:19 2012
New Revision: 1330197

URL: http://svn.apache.org/viewvc?rev=1330197&view=rev
Log:
DERBY-5708: simpleThread test doesn't release connection

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleThread.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleThread.java?rev=1330197&r1=1330196&r2=1330197&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleThread.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/simpleThread.java
Wed Apr 25 11:19:19 2012
@@ -31,7 +31,7 @@ import org.apache.derby.tools.ij;
 /*
 	This is from a bug found by a beta customer.
  */
-public class simpleThread implements Runnable {
+public class simpleThread extends Thread {
 
         private static Connection _connection = null;
         private static boolean _inUse = false;
@@ -47,7 +47,7 @@ public class simpleThread implements Run
                 _wait = waitTime;
                 _myCount = getCount();
                 _query = query;
-                new Thread(this).start();
+                start();
         }
 
         public void run() {
@@ -107,15 +107,19 @@ public class simpleThread implements Run
 
             String query = "SELECT * from people ORDER by name";
 
-            try {
-                String[] retval = new String[4];
-                new simpleThread(query,0);
-                new simpleThread(query,10000);
-                new simpleThread(query,10100);
-                new simpleThread(query,20000);
-            } catch (Exception ex) {
-                System.err.println(ex.toString() );
+            Thread[] threads = {
+                new simpleThread(query,0),
+                new simpleThread(query,10000),
+                new simpleThread(query,10100),
+                new simpleThread(query,20000),
+            };
+
+            for (int i = 0; i < threads.length; i++) {
+                threads[i].join();
             }
+
+            _connection.close();
+            _connection = null;
         }
 
         public static Connection GetConnection() {



Mime
View raw message