Hi,

On Wed, 15 Oct 2003 16:24:00 +0200, Vincent ARBONA <[EMAIL PROTECTED]> wrote:

Yes, when I use tx demarcation, it work perfectly.

What I have to do, finally, is a client-server application under tomcat. So
many client can call simultanouesly
PersistenceBrokerFactory.createPersistenceBroker(key). It may happen that
more than 8 PersistenceBroker are instanciated in the same time, and so this
SocketClosed exception happen, even if I use tx demarcation...


So is it normal that the SocketClosed exception occurs wherever I have not
exaust the connection-pool ?



I think the SocketClosed exception caused by oracle, maybe RDBMS connection pool is exausted or connections get timed out. How many active connections allowed by oracle? Seems your RDBMS specific pool exhaust before the OJB connection-pool.

To disassociate the connection from a PersistenceBroker
instance
do close the PB instance
or commitTx/rollbackTx.
If you don't do this, connections scale 1:1 with PB instances.

In future versions of OJB (ca 1.0XX) the disassociation
will be done automatically if no tx-demarcation is used,
then you don't need to close the PB instance to disassociate.

By the way, OJB is shipped with a multi-threaded
performance/stress test.
see
http://db.apache.org/ojb/performance.html#Multithreaded
section 'OJB performance in multi-threaded environments'
You can easy modify test properties only run against the PB-api
(see perf-test target in build.xml)


regards, Armin





----- Original Message ----- From: "Armin Waibel" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Wednesday, October 15, 2003 4:06 PM Subject: Re: Multiple PersistenceBroker instances - Socket Close


Hi,

On Wed, 15 Oct 2003 15:55:35 +0200, Vincent ARBONA
<[EMAIL PROTECTED]> wrote:

> Hi Armin,
>
> In fact, my problem is that I did not exhaust my pool (max-Active=100,
> max-Idle=100).
> After only 8 instanciations of a PersistenceBroker, I have the
> SocketClosed
> exception.
> (in my test,  I intentionally comment the "p.close()" instruction to
> exhaut
> my pool)
>
You have to differ between the PB pool and the connection-pool
(depends on the used ConnnectionFactory implementation - by default
non DataSources will be pooled) and the maximal supported connections
of your RDBMS.
When using OJB default settings the connection pool size is 21, thus
your RDBMS should support >=21 active connections.

Did you test using PB tx-demarction in your test? This will close/return
to
pool the connection, but do not close the PB instance.

regards,
Armin

> Logically an exception would occur after 101 instanciations of a
> PersistenceBroker not after 8 (and this exception not expected to be a
> SocketClosed Exception)
>
>
>
>
>
> ----- Original Message -----
> From: "Armin Waibel" <[EMAIL PROTECTED]>
> To: "OJB Users List" <[EMAIL PROTECTED]>
> Sent: Wednesday, October 15, 2003 3:40 PM
> Subject: Re: Multiple PersistenceBroker instances - Socket Close
>
>
>> Hi,
>>
>> On Wed, 15 Oct 2003 15:29:39 +0200, Vincent ARBONA
>> <[EMAIL PROTECTED]> wrote:
>>
>> > Hi,
>> >
>> > I have the following problem :
>> >
>> > I execute this code to test "connection pool max-active" parameter :
>> >
>> >
>> > public void testMultipleBroker() {
>> > int nbBroker = 200;
>> >
>> > PersistenceBroker b = null;
>> > PBKey key = new PBKey("varbona"); //varbona is my jdc-alias
>> >
>> > try {
>> > for (int i = 0; i < nbBroker; i++) {
>> > System.out.println("cnx n�" + i);
>> >
>> > b = PersistenceBrokerFactory.createPersistenceBroker(key)
>> >
>> > QueryByCriteria q = new
>> > QueryByCriteria(org.udb.candisup.back.dto.domain.CiviliteDTO.class);
>> >
>> > Collection c = b.getCollectionByQuery(q);
>> >
>> > // I do not close the persistence broker !!
>> > //b.close();
>>
>> if do not close the broker instance the associated connection
>> (assosiated on getCollectionByQuery) wasn't closed too --> then
>> your connection pool can exhaust. If you
>> don't want to close the PB instance (for your special test case), then
>> use PB-tx demarcation around the query. On PB.commitTransaction()
>> the associated connection will be closed.
>>
>> regards,
>> Armin
>>
>>
>> > }
>> > }
>> > catch (SystemException ex) {
>> > System.out.println(ex.getMessage());
>> > }
>> > }
>> >
>> > After eight instanciation of PersistanceBroker (nbBroker=7), I always
>> > have this error :
>> >
>> > java.sql.SQLException: Exception d'E/S: Socket closed
>> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
>> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
>> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
>> > at
>> >
>>
oracle.jdbc.driver.OracleConnection.rollback(OracleConnection.java:1380)
>> >  at
>> >
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localRollback(Unknow
> n
>> > Source)
>> >  at
>> >
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.abortTransaction(Unknown
>> > Source)
>> >
>> > [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] ERROR:
>> > Rollback on the underlying connection failed
>> > Exception d'E/S: Socket closed
>> > at org.apache.ojb.broker.core.PersistenceBrokerImpl.close(Unknown
>> > Source)
>> > at org.apache.ojb.broker.core.PersistenceBrokerImpl.finalize(Unknown
>> > Source)
>> > at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
>> > at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
>> > at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
>> > at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
>> >
>> > java.sql.SQLException: Exception d'E/S: Socket closed
>> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
>> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
>> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
>> > at
>> >
>>
oracle.jdbc.driver.OracleConnection.rollback(OracleConnection.java:1380)
>> >  at
>> >
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localRollback(Unknow
> n
>> > Source)
>> >  at
>> >
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.abortTransaction(Unknown
>> > Source)
>> > at org.apache.ojb.broker.core.PersistenceBrokerImpl.close(Unknown
>> > Source)
>> > at org.apache.ojb.broker.core.PersistenceBrokerImpl.finalize(Unknown
>> > Source)
>> > at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
>> > at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
>> > at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
>> > at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
>> > [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] ERROR:
>> > Rollback on the underlying connection failed
>> > Exception d'E/S: Socket closed
>> >
>> >
>> > Here is my connection descriptor
>> >
>> > <jdbc-connection-descriptor
>> > jcd-alias="varbona"
>> > default-connection="false"
>> > platform="Oracle9i"
>> > jdbc-level="2.0"
>> > driver="oracle.jdbc.driver.OracleDriver"
>> > protocol="jdbc"
>> > subprotocol="oracle"
>> > dbalias="thin:@192.168.1.202:1525:TEST"
>> > username="varbona"
>> > password="opiweb"
>> > eager-release="false"
>> > batch-mode="false"
>> > useAutoCommit="2"
>> > ignoreAutoCommitExceptions="true"
>> > >
>> > <connection-pool
>> > maxActive="100"
>> > maxIdle="50"
>> > whenExhaustedAction="2"
>> > validationQuery="" />
>> >
>> > <sequence-manager
>> >
>
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
>> >             <attribute attribute-name="grabSize"
>> attribute-value="20"/>
>> >             <attribute attribute-name="autoNaming"
>> > attribute-value="true"/>
>> >             <attribute attribute-name="globalSequenceId"
>> > attribute-value="false"/>
>> >             <attribute attribute-name="globalSequenceStart"
>> > attribute-value="10000"/>
>> >         </sequence-manager>
>> >    </jdbc-connection-descriptor>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to