• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding CachedRowSet instance tracking

 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I would like to know when exactly the CachedRowSet is going to be eligible for GC. With a little homework I learned that when the user session ends then it would be qualified for GC. Moreover, how is the user session tracked in such cases. What is the "session" here in this context?
Sample scenarios,
Scn 1: When I directly access CachedRowSet from servlet
Scn 2: When I have a stateless session bean and then a JDBC call

in Scn1- I can somehow get the session reference and hence i could maintain. How about the Scn 2? I would only have user thread Id in this case. So how does it work? Is it going to consider the thread id for tracking the existence of the CachedRowSet?
Do we have any good reference articles and links. Correct me if I am wrong somewhere.

Thank you in advance
 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A CachedRowSet is just like any other java instance variable as far as GC is concerned, the caching only means that you can close the database collection and still have the data (unlike a ResultSet).

Hope that was some help.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Gibbons,
It opens lot of gaps to learn that " it would act like instance variable as far GC is concerned". So when I come out of the behavior/operation then, is this data lost? For example, I have a method in DAO which uses CRS when the flow comes out of this class, Is the CRS used eligible for GC? If the answer is yes then it is good else it should be somehow referenced.

Thank you in advance
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rephrase that question using int instead of cachedRowSet, what would the answer be?

if you no longer have a reference to the DAO, and no longer have a referance to the CRS then it is ready to GC, the data will be lost from memory (it will of course still be on the database).
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you again, I got it, crystal clear. Initially my perspective was like it acts as something like a state full container for the complete session. This makes sense for using it cleverly.
Thank you
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic