Hi Armin,
I checked the complete code and every time PB is retrieved it is closed.
I used the PersistenceBrokerFactoryFactory.instance().activePersistenceBroker() 
function for debugging

   System.out.println("\n\n Active Instances[BEFORE CLOSING]: " + 
PersistenceBrokerFactoryFactory.instance().activePersistenceBroker());
   if(broker != null) {
            broker.close();
   }
   System.out.println("\n\n Active Instances[AFTER CLOSING]: " + 
PersistenceBrokerFactoryFactory.instance().activePersistenceBroker());

The output I get is 

 Active Instances[BEFORE CLOSING]: 1
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: PB.close was called: 
[EMAIL PROTECTED]
 Active Instances[AFTER CLOSING]: 0

It is releasing the instance to the pool, but my problem or question is that 
why are mysql instances increasing
I checked the server proccess they where 10 before PB was called
but after closing PB (PB.close())
The active instances are back to zero, but the mysql instances increase to 11

Why is this happening. The only thing I changed in OJB.properties file was 
whenExhaustedAction=0 to whenExhaustedAction=2, this change I made so that when 
the connections exhaust it should not crash or give an error.





----- Original Message ----- 
From: "Armin Waibel" <[EMAIL PROTECTED]>
Newsgroups: gmane.comp.jakarta.ojb.user
Sent: Friday, December 17, 2004 5:06 PM
Subject: Re: Connection Problem : Connection not bieng closed


> Hi Bikram,
> 
> Bikram B Kapoor wrote:
> > Hi All,
> > I am using PersistanceBroker in one of my code along with struts.
> > 
> > 
> > I use the following code
> > try {
> > PersistenceBroker broker =
> > PersistenceBrokerFactory.defaultPersistenceBroker();
> > 
> > // ......
> > ..... DATABASE CALLS
> > ..... RECORD FETCHING
> > 
> > }
> > catch(Exception e) {
> >     //Logging functions
> > }
> > finally {
> >     if(broker != null) {
> >         broker.close();
> >     }
> > 
> > }
> > 
> > 
> > But what I notice in process that after some time the number of Mysql
> > Instances increase, the more user try to access the site, the slow it gets
> > and more mysql processes/instances are created.
> > 
> 
> hmm, assume you are using OJB default settings, when you call PB.close() 
> the PB instance was returned to PB-pool and it's guaranteed that the 
> used connection was released and returned to connection-pool.
> Maybe you missed to close a used PB instance?
> You can get the number of active PB instance with 
> PersistenceBrokerFactoryFactory.instance().activePersistenceBroker()
> 
> 
> > I tried using
> > PersistenceBrokerFactory.releaseAllInstances();
> 
> this only clear the PB pool and does not cleanup abandoned PB instances.
> Assume you have a PB leak.
> 
> regards,
> Armin
> 
> 
> > after broker.close();
> > 
> > but to no avail. Can any body tell me where the problem is or where do I
> > have to make changes in order to resolve this problem. Because if the number
> > of user reaches a higher number then I would face "To many connections open"
> > problem.
> > 
> > 
> > Please help.
> > 
> > Regards
> > Bikram B Kapoor
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> >

Reply via email to