#22 block when connect oracle ojdbc14.jar jre1.5.0_05

closed
nobody
None
5
2014-07-13
2005-12-14
Anonymous
No

INFO:C3P0Registry-Initializing c3p0-0.9.0.2 [built 26-
September-2005 12:55:26 -0400; debug? true; trace: 10]
jdbc driver:ojdbc14.jar
jre1.5.0_05
win2000 server

c3p0.maxPoolSize=100
c3p0.maxStatements=2500
c3p0.maxStatementsPerConnection=0
c3p0.minPoolSize=20
c3p0.numHelperThreads=10

test class:
public class PoolLoadTest
implements Runnable
{

protected static int threadCount = 10;
protected static int duration = 1 * 60 * 1000 / 2;

protected int counter;
protected int index;
protected static boolean stopped = false;
protected static volatile int threadsRunning = 0;
protected static int[] counters = new int
[threadCount];

/** Creates a new instance of PoolLoadTest */
public PoolLoadTest(int index)
{
this.index = index;
}

public void run()
{
synchronized (PoolLoadTest.class)
{
++threadsRunning;
}
try
{
Thread.sleep(200);
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
while (!stopped)
{
//String sql = "some sql";
//Connection conn = ConFactory.getCon();
//Table.select(sql);
//conn.close();

++counter;
}
++counter;
}
catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
synchronized (PoolLoadTest.class)
{
--threadsRunning;
}
}
counters[index] = counter;
}

public static void main(String args[])
{
try
{
ConnectionPool.init();
}
catch (NanwangException e1)
{
e1.printStackTrace();
}
long a= System.currentTimeMillis();
for (int i = 0; i < threadCount; ++i)
{
Thread t = new Thread(new PoolLoadTest
(i), "Thread " + i);
t.setDaemon(true);
t.start();
}
try
{
Thread.sleep(duration);
}
catch (Exception e)
{
e.printStackTrace();
}
stopped = true;
System.out.println(System.currentTimeMillis() - a);
while (threadsRunning > 0)
{
try
{
Thread.sleep(100);
}
catch (Exception e)
{
e.printStackTrace();
}
}
System.out.println(System.currentTimeMillis() - a);
int sum = 0;
for (int i = 0; i < threadCount; ++i)
{
System.out.println("Thread " + i + ":" + counters
[i]);
sum += counters[i];
}
System.out.println("All Threads :" + sum);
ConnectionPool.close();
}

}
output:
30003
40328
Thread 0:2
Thread 1:9
Thread 2:6
Thread 3:2
Thread 4:2
Thread 5:2
Thread 6:2
Thread 7:2
Thread 8:2
Thread 9:2
All Threads :31
when run using j2re1.4.2_10
output:
30074
30084
Thread 0:1362
Thread 1:1357
Thread 2:1329
Thread 3:1346
Thread 4:1327
Thread 5:1346
Thread 6:1357
Thread 7:1338
Thread 8:1322
Thread 9:1333
All Threads :13417

Discussion

  • Steve Waldman
    Steve Waldman
    2006-09-07

    Logged In: YES
    user_id=175530

    hi. i'm really sorry this has gone unaddressed for so long.
    but i don't really understand what's going on. you're
    testing c3p0's throughput, and finding it falling very badly
    under jdk1.5... but your commented out code is hard to make
    sense of, and without it there are no real operations.
    there's a lot of mystery in your operations with ConFactory
    and Table. it's hard for me to comment. if you are still
    seeing throughput problems with c3p0, and can provide a
    little more information, please let me know.

     
  • Steve Waldman
    Steve Waldman
    2006-09-07

    • status: open --> closed