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 norg.apache.ojb.broker.core.PersistenceBrokerImpl.abortTransaction(Unknown> Source) > at >> 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 norg.apache.ojb.broker.core.PersistenceBrokerImpl.abortTransaction(Unknown> Source) > at >className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">> 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 >> <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]
