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 Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br> on 2003/05/13 20:57:17 UTC

Threads & connection closing

Hi!

I'm still hacking my VLA in Swing and know this is happenning:

GUI has buttons to Next/Previous records, that are selected in a complex
query. Any SQL hacker knows how to navigate records using pure SQL, right
;-)

Well, when the user just "clicking away wasting the database time", one
connection is closed during the process mounting/executing a query.

Should not OJB synchronize access to connection object do avoid this kind of
error?

I've tried to synchronize the methods related to connections in
ConnectionManagerImpl and ConnectionFactoryDBCPImpl (I'm using DBCP by
now)... Appear that solves my threading problem.

The other problem is related to OJB not releasing connections in
multi-threaded environments... After some time using the software I get
exceptions due to not having connections avaliable. The stack trace is:

Used ConnectionManager instance could not obtain a connection: Can't get
connection from DataSource: java.util.NoSuchElementException


I need to explicit release something when I'm not using a PersistenceBroker
any more?

Thanks for any help...

Edson Richter







---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.480 / Virus Database: 276 - Release Date: 12/5/2003

Re: Threads & connection closing

Posted by Edson Carlos Ericksson Richter <er...@mgrinformatica.com.br>.
My fault: I was not closeing brokers after use...

Well, now I get no more errors... Even removing my silly synchronized,
all works... I don't remember to read something about this (closing
brokers) in tutorials... Even sample code doesn't close brokers...

Can you fix docs so others don't waste time with this?

And, of to all that put mind in my problems, very thanks by your
attention. Now, I get 1.0 RC3+patch for access config working fully in
my Swing multi-threaded app (except that 1:n relations don't deleting
contained objects even using RemovalAwareList -- in m:n mapping this
works fine. I've sample code I can send to you, just tell me to what
address since it will not fit inline here).


Thanks,

Edson Richter



Em Ter, 2003-05-13 às 15:57, Edson Carlos Ericksson Richter escreveu:
> Hi!
> 
> I'm still hacking my VLA in Swing and know this is happenning:
> 
> GUI has buttons to Next/Previous records, that are selected in a complex
> query. Any SQL hacker knows how to navigate records using pure SQL, right
> ;-)
> 
> Well, when the user just "clicking away wasting the database time", one
> connection is closed during the process mounting/executing a query.
> 
> Should not OJB synchronize access to connection object do avoid this kind of
> error?
> 
> I've tried to synchronize the methods related to connections in
> ConnectionManagerImpl and ConnectionFactoryDBCPImpl (I'm using DBCP by
> now)... Appear that solves my threading problem.
> 
> The other problem is related to OJB not releasing connections in
> multi-threaded environments... After some time using the software I get
> exceptions due to not having connections avaliable. The stack trace is:
> 
> Used ConnectionManager instance could not obtain a connection: Can't get
> connection from DataSource: java.util.NoSuchElementException
> 
> 
> I need to explicit release something when I'm not using a PersistenceBroker
> any more?
> 
> Thanks for any help...
> 
> Edson Richter
> 
> 
> 
> 
> 
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.480 / Virus Database: 276 - Release Date: 12/5/2003