Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

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 ???
 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic