Howdy,

>This is a bit off topic.

Then please mark it as such.  See modified Subject for this message.

>I am using connection pooling, and in my code, I open all the
connection I
>need in an object constructor.
>Then I will close this connection in finalize(), which (according to
what I
>read) will be executed during java garbage collect.

Bad practice.  Connections are scarce resources and should be held for
the minimum amount of time.  Grab them from the pool, run whatever query
you need, release them back to the pool.  Make sure your release code
handles exception and does not hold on to connections.

Do not wait for the finalize() methods.  They will be called during GC,
yes, but it is difficult if not impossible to know exactly when GC will
be called for your specific objects, even after no references are held
to them.

Yoav Shapira
Millennium ChemInformatics




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to