my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes Manually delete entity bean in memory? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Manually delete entity bean in memory?" Watch "Manually delete entity bean in memory?" New topic
Author

Manually delete entity bean in memory?

yik yang
Greenhorn

Joined: May 30, 2002
Posts: 6
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....
Pushkal Mishra
Greenhorn

Joined: Sep 17, 2003
Posts: 10
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

Joined: May 30, 2002
Posts: 6
but can we call unsetEntityContext() MANUALLY from session bean? I thought unsetEntityContext() is called AUTOMATICALLY by the ejb container?
Pushkal Mishra
Greenhorn

Joined: Sep 17, 2003
Posts: 10
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
s basetti
Greenhorn

Joined: Jun 16, 2002
Posts: 14
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...
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

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.


Groovy
Vinod John
Ranch Hand

Joined: Jun 23, 2003
Posts: 162
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

Joined: Feb 27, 2002
Posts: 8898

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

Joined: Jun 23, 2003
Posts: 162
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 ???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Manually delete entity bean in memory?
 
Similar Threads
unsetEntityContext and no unsetSessionContext
Table update with XDoclet/EJB2
string pool
manually call unsetEntityContext?
delete a record from db