About Question enthuware.oce-ejbd.v6.2.462 :

Moderator: admin

Post Reply
jszczepankiewicz

About Question enthuware.oce-ejbd.v6.2.462 :

Post by jszczepankiewicz » Sun May 01, 2011 1:26 pm

In the answer (explanation) is "(...)has been designated as a Removemethod(...)",
should be:
"(...)has been designated as a Remove method(...)".

admin
Site Admin
Posts: 8187
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.462 :

Post by admin » Mon May 02, 2011 6:33 am

This has been fixed.
Thank you for the feedback!
If you like our products and services, please help us by posting your review here.

max2fl
Posts: 33
Joined: Mon May 02, 2011 5:09 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.462 :

Post by max2fl » Mon Jun 06, 2011 6:30 pm

Hi,

from explanations:
An ejb acquires resources in PostCreate (and PostActivate) callback methods and it releases the same resources in PreDestroy (and PrePassivate) methods.
should be:
An ejb acquires resources in PostConstruct (and PostActivate) callback methods and it releases the same resources in PreDestroy (and PrePassivate) methods.

prakashyaji
Posts: 25
Joined: Sun May 13, 2012 1:39 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.462 :

Post by prakashyaji » Sun May 13, 2012 6:45 am

Hi Paul,

I need one doubt here... Please help me...
"Remember:
An ejb acquires resources in PostConstruct (and PostActivate) callback methods and it releases the same resources in PreDestroy (and PrePassivate) methods.
If a bean is passivated and if the timeout occurs, the container does not call the PreDestroy method."

Here, I remember reading somewhere that, if SystemException occurs then also PreDestroy method is not invoked. In such scenarios we have to do cleanup in lifecycle event callback interceptors. Am I correct? Please clarify.

admin
Site Admin
Posts: 8187
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.462 :

Post by admin » Sun May 13, 2012 5:31 pm

prakashyaji wrote:Hi Paul,

I need one doubt here... Please help me...
"Remember:
An ejb acquires resources in PostConstruct (and PostActivate) callback methods and it releases the same resources in PreDestroy (and PrePassivate) methods.
If a bean is passivated and if the timeout occurs, the container does not call the PreDestroy method."

Here, I remember reading somewhere that, if SystemException occurs then also PreDestroy method is not invoked. In such scenarios we have to do cleanup in lifecycle event callback interceptors. Am I correct? Please clarify.
PreDestroy is a life cycle call back listener method and it is not called in case of system exception.
As per Section 4.6.3 of EJB 3.1 specification:
The application using the session bean should provide some clean up mechanism to periodically clean up the unreleased resources.
For example, if a shopping cart component is implemented as a session bean, and the session bean stores the shopping cart content in a database, the application should provide a program that runs periodically and removes “abandoned” shopping carts from the database.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

henrid
Posts: 21
Joined: Sun Oct 13, 2013 1:20 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.462 :

Post by henrid » Thu Feb 07, 2019 1:08 pm

I once read in a book that every stateful session bean should have at least one method with @Remove. But I cannot find it in the spec, so can anyone confirm that my statement is true or false?

admin
Site Admin
Posts: 8187
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.462 :

Post by admin » Fri Feb 08, 2019 1:07 am

As per section 4.3.11:
A stateful session bean written to the EJB 3.x API typically has one or more remove methods designated by means of the Remove annotation or remove-method deployment descriptor element.
So, it is not mandatory but used commonly so that the bean can do any cleanup while being removed.
If you like our products and services, please help us by posting your review here.

henrid
Posts: 21
Joined: Sun Oct 13, 2013 1:20 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.462 :

Post by henrid » Fri Feb 08, 2019 1:38 pm

Good to know, thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests