Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Manually delete entity bean in memory?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Other than reducing the entity bean pool size using admin console, is there any other way to manually delete the allocated entity bean from the memory?
I dont want to call ejbRemove bcos it will delete my actual record from database. What i want is after completed a certain functions, and i am pretty sure that the entity bean which i allocated in those functions are 100% no longer to be used and would like to free them from memory....
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
unsetEntityContext()
this is the best we can do. After that it is over to the container to garbage collect the object.
Please correct me if I am wrong.
Thanks,
Pushkal
 
yik yang
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but can we call unsetEntityContext() MANUALLY from session bean? I thought unsetEntityContext() is called AUTOMATICALLY by the ejb container?
 
Pushkal Mishra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya you are right, it is invoked by the container only. My oversight!!
I don't know any other way. Let me know if you find something.
Pushkal
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
before knowing that just call the method & see inside session bean..whether instance can be manually sent to the pool.
I guess EJBRemove() removes the instance & not from DB. Pls. call this as well from your session bean & see..
Pls. write your results here as well...
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I guess EJBRemove() removes the instance & not from DB


The db row is removed but not the bean form memory. You can manually delete a bean throw SystemException.
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by yik yang:
Other than reducing the entity bean pool size using admin console, is there any other way to manually delete the allocated entity bean from the memory?


Is there any particular reason you don't want to do this ?

Originally posted by Pradeep Bhat:

The db row is removed but not the bean form memory. You can manually delete a bean throw SystemException.


Actually the bean will be removed from the memory but the app server may replace it with another upon request, so the as long as the pool size mentions x beans there is a good chance x number will be mailtained in the mmemory.
 
Pradeep bhatt
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Actually the bean will be removed from the memory but the app server may replace it with another upon request


Are you talking about entity beans or session beans ? I am talking about entity beasn. When ejbRemove in entity bean is called the bean return to pool. Read page # 247 of spec.
 
Vinod John
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:

Are you talking about entity beans or session beans ? I am talking about entity beasn. When ejbRemove in entity bean is called the bean return to pool. Read page # 247 of spec.


My comment for about the "SystemException" not ejbRemove(). BTW, thanks for your spec reference but you missed the version ???
 
Look! It's Leonardo da Vinci! And he brought a tiny ad!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic