|
Two things
1) Don't confuse reclaiming an object with the operations need to reclaim
system level resources.
- In any situation where you are using system level resources (files,
databases, graphics services), you should take responsibility for the
close, free, whatever call.
Key point: You don't control when the garbage collector runs and it
doesn't run because objects *could* be cleaned up. It runs because it has
to.
2) Don't assume that because you don't have access to an object that its
unreachable.
- Example, you let go of a statement object... therefore it can be
garbage collected, right?
- But there are references connecting a statement and its connection
both directions (because they end up needing each other to function
properly)
- And there is a Pool object that has all the connection objects (so
it can do proper cleanup for you in various abnormal conditions)
- And someone has a reference to the pool so that you can get a
connection again, right?
- ... it becomes hard to call these objects unreachable in this
scenario, doesn't it?
Key point: Your application code isn't running in a vacuum on the
system. There are all kinds of object references all over the place.
Bottom line: Do the right thing and close your resources. You will be
rewarded with greater scalability, portability, and maintainability in your
applications.
Regards,
Richard D. Dettinger
AS/400 Java Data Access Team
"Biologists have a special word for stability -- dead"
Larry Wall
Open Source Developers Journal
Issue 1, Jan 2000
Madhavan Varadarajan <seawolf00@yahoo.com>@midrange.com on 07/02/2001
10:39:31 AM
Please respond to JAVA400-L@midrange.com
Sent by: owner-java400-l@midrange.com
To: JAVA400-L@midrange.com
cc:
Subject: Re: JDBC Connection Pooling - Fred ?
Fred, I thought that GC also removes objects which
have no references (i.e. unreachable ?) So, if your
statement objects/result set objects do not have a
reference (beause the connection pool has been pushed
back to the con pool), they ideally need to be GC'd -
Am I right ?
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.