You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Reda Benzair <re...@smartjog.com> on 2004/01/12 17:54:02 UTC

Re: Connection: Socket Close Exception

Hi Thierry
I already had this problem  in my Application
it there possibility of forgetting to it closed problem of configuration 
of Oracle
forget the brocker close  for your application
problem of configuration of Oracle number off statement open default is 
very limited but you can change this !
Thierry Hanot wrote:

>Hello  All 
>There is very Weird problem on the PersistenceBroker :
>    - Allocate a new Broker 
>    - Get something on it ( iterator by query or identity ... )
>    - Let the GC free the broker 
>    - Request a new broker with the same PBKey 
>    - Make the same request 
>    ** an Exception is throw Socket Close exception 
> 
> 
>Using latest Oracle 9i driver for 1.4 and thin driver 
>OJB RC05
>org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
>JRE 1.4.2.02
> 
> 
>Is Somebody can help me .
> 
>THX 
> 
>Thierry 
> 
> 
> 
>Here is my test case 
> 
> 
>WeakReference ref = null;
>PBKey key =
>PersistenceBrokerFactory.defaultPersistenceBroker().getPBKey();
>PersistenceBroker broker =
>PersistenceBrokerFactory.createPersistenceBroker(key);
>// GET SOMETHING 
>Query q =
>QueryFactory.newQuery(
>DbObjectFactory.instance().getTwtzonesetsClass(),
>(Criteria) null);
>broker.getObjectByQuery(q);
>// GET IS DONE
>// ENABLE GC FOR RELEASING PB
>// if a broker.close() is done , the test is working fine .
> 
>// KEEP A REF FOR BEING SUR OF PB RELEASE BY GC
>ref = new WeakReference(broker);
> 
>broker = null;
>System.gc();
>System.gc();
>System.gc();
>Thread.sleep(1000);
>System.gc();
>System.gc();
>System.gc();
>Thread.sleep(1000);
>Object o = ref.get();
>// NORMALLY THE BROKER IS RELEASE REF IS NULL
>assertTrue(o == null);
>// RETRIEVE A NEW BROKER
>broker = PersistenceBrokerFactory.createPersistenceBroker(key);
>q =
>QueryFactory.newQuery(
>DbObjectFactory.instance().getTwtzonesetsClass(),
>(Criteria) null);
> 
>// HERE AN EXCEPTION IS THROW : Socket Close exception 
>broker.getObjectByQuery(q);
> 
>
>  
>


-- 
*Reda BENZAIR**
*Software Analyst

***
*Phone: +33 (0)1 4996 6324
Fax: +33 (0)1 4996 6405
Mobile: +33 (0)6 6240 6192
reda.benzair@smartjog.com <ma...@smartjog.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Connection: Socket Close Exception

Posted by Andy Malakov <an...@transdecisions.com>.
It is also a good idea to use validation query in <jdbc-connection-descriptor>. This validation query ensures that pooled connection
is still alive.

For example:

        <connection-pool
           maxActive="21"
           whenExhaustedAction="2"
           validationQuery="SELECT 12345 FROM DUAL"
           testOnBorrow="true"
        />

----- Original Message ----- 
From: "Reda Benzair" <re...@smartjog.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Monday, January 12, 2004 11:54 AM
Subject: Re: Connection: Socket Close Exception


> Hi Thierry
> I already had this problem  in my Application
> it there possibility of forgetting to it closed problem of configuration
> of Oracle
> forget the brocker close  for your application
> problem of configuration of Oracle number off statement open default is
> very limited but you can change this !
> Thierry Hanot wrote:
>
> >Hello  All
> >There is very Weird problem on the PersistenceBroker :
> >    - Allocate a new Broker
> >    - Get something on it ( iterator by query or identity ... )
> >    - Let the GC free the broker
> >    - Request a new broker with the same PBKey
> >    - Make the same request
> >    ** an Exception is throw Socket Close exception
> >
> >
> >Using latest Oracle 9i driver for 1.4 and thin driver
> >OJB RC05
> >org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
> >JRE 1.4.2.02
> >
> >
> >Is Somebody can help me .
> >
> >THX
> >
> >Thierry
> >
> >
> >
> >Here is my test case
> >
> >
> >WeakReference ref = null;
> >PBKey key =
> >PersistenceBrokerFactory.defaultPersistenceBroker().getPBKey();
> >PersistenceBroker broker =
> >PersistenceBrokerFactory.createPersistenceBroker(key);
> >// GET SOMETHING
> >Query q =
> >QueryFactory.newQuery(
> >DbObjectFactory.instance().getTwtzonesetsClass(),
> >(Criteria) null);
> >broker.getObjectByQuery(q);
> >// GET IS DONE
> >// ENABLE GC FOR RELEASING PB
> >// if a broker.close() is done , the test is working fine .
> >
> >// KEEP A REF FOR BEING SUR OF PB RELEASE BY GC
> >ref = new WeakReference(broker);
> >
> >broker = null;
> >System.gc();
> >System.gc();
> >System.gc();
> >Thread.sleep(1000);
> >System.gc();
> >System.gc();
> >System.gc();
> >Thread.sleep(1000);
> >Object o = ref.get();
> >// NORMALLY THE BROKER IS RELEASE REF IS NULL
> >assertTrue(o == null);
> >// RETRIEVE A NEW BROKER
> >broker = PersistenceBrokerFactory.createPersistenceBroker(key);
> >q =
> >QueryFactory.newQuery(
> >DbObjectFactory.instance().getTwtzonesetsClass(),
> >(Criteria) null);
> >
> >// HERE AN EXCEPTION IS THROW : Socket Close exception
> >broker.getObjectByQuery(q);
> >
> >
> >
> >
>
>
> -- 
> *Reda BENZAIR**
> *Software Analyst
>
> ***
> *Phone: +33 (0)1 4996 6324
> Fax: +33 (0)1 4996 6405
> Mobile: +33 (0)6 6240 6192
> reda.benzair@smartjog.com <ma...@smartjog.com>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org