You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by si...@telenor.com on 2003/03/14 10:00:01 UTC

Problems with multiple concurrent threads using the connection pool

Hi!

We are using Torque 3.0, running in a WebLogic Container. Our application is using Struts for the GUI, and a combination of Torque and entity beans for persistence. We use Torque for semi-static data.

It all behaved beautifully until we started load testing. We find that once the number of concurrent threads approach the size of the db connection pool, the threads die, or receive null pointer connection objects. It happens when client thread performs a save() on a generated Object. 

I've been trying these types of pools, with various resulting behaviours 

org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory:	
	The threads die, to never wake up again

org.apache.torque.dsfactory.JndiDataSourceFactory:		
	Received null pointer connections

org.apache.torque.dsfactory.TorqueDataSourceFactory: 		
	Received null pointer connections, see below

java.lang.NullPointerException: Connection object was null. This could be due to a misconfiguration of the DataSourceFactory. Check the logs and Torque.properties to better determine the cause.
	at org.apache.torque.util.Transaction.rollback(Transaction.java:179)
	at org.apache.torque.util.Transaction.safeRollback(Transaction.java:221)
	at com.telenor.mobil.content.ekspress.business.om.BaseNotification.save(BaseNotification.java:495)
	at com.telenor.mobil.content.ekspress.business.om.BaseNotification.save(BaseNotification.java:470)
	at com.telenor.mobil.content.ekspress.test.loadtest.TestNotification.run(TestNotification.java:33)

Has anyone else experienced this kind of problem?

Regards, Simen Sommerfeldt

<-----------------------snip----------------------------->

(Below is the code for the threads in the test program that we wrote to provoke the error outside of Weblogic):

    public void run() {
        for (int i = 0; i < (count); i++) {
            Notification no = new Notification();
            try {
                // Set some random data
		    // Keys are generated automatically through the broker thread
                no.setMerchantId(1000);
                no.setNotificationType((byte)0);
                no.setNotificationInterval((byte)0);

                no.setNotificationAddress(Integer.toString(threadIndex) + " " + Integer.toString(count));

                System.out.println("Before saving " + threadIndex);
                no.save();
                System.out.println("After saving " + threadIndex);

                no=null;
                sleep(delay);

            } catch (TorqueException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }