sebb 2004/02/26 15:05:58
Modified: src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler
JDBCSampler.java
Log:
TestStarted is too early to be able to set up a database connection
Revision Changes Path
1.27 +20 -16
jakarta-jmeter/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
Index: JDBCSampler.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- JDBCSampler.java 26 Feb 2004 00:34:34 -0000 1.26
+++ JDBCSampler.java 26 Feb 2004 23:05:58 -0000 1.27
@@ -160,9 +160,9 @@
return res;
}
- private DBKey getKey() throws ConnectionPoolException
+ private synchronized DBKey getKey() throws ConnectionPoolException
{
- if (dbkey == null)
+ if (dbkey == null)
{
// With multiple threads, it is possible that more than one thread
// will enter this block at the same time, resulting in multiple
@@ -274,18 +274,22 @@
public synchronized void testStarted()
{
- log.debug("testStarted(), thread: "+Thread.currentThread().getName());
- // The first call to getKey for a given key will set up the connection
- // pool. This can take awhile, so do it while the test is starting
- // instead of waiting for the first sample.
- try
- {
- getKey();
- }
- catch (ConnectionPoolException e)
- {
- log.error("Error initializing database connection", e);
- }
+/*
+ * Test started is called before the thread data has been set up, so cannot
+ * rely on its values being available.
+*/
+// log.debug("testStarted(), thread: "+Thread.currentThread().getName());
+// // The first call to getKey for a given key will set up the connection
+// // pool. This can take awhile, so do it while the test is starting
+// // instead of waiting for the first sample.
+// try
+// {
+// getKey();
+// }
+// catch (ConnectionPoolException e)
+// {
+// log.error("Error initializing database connection", e);
+// }
}
public void testEnded(String host)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]