For option 1 "The container must always call @PrePassivate method before passivating a bean."
But it is possible that the bean provider does not define such a method.
In this case, the container will not call this method.
About Question com.enthuware.oce-ejbd.v6.2.528
Moderator: admin
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.oce-ejbd.v6.2.528
Yes, of course, if the method is not there then there is no question about calling it.
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question com.enthuware.oce-ejbd.v6.2.528
So, is option 1 still the correct option ? The word "must always" is the key.
The container does not call the @PrePassivate method if the bean provider does not define one.
The container does not call the @PrePassivate method if the bean provider does not define one.
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.oce-ejbd.v6.2.528
Yes, if the method is there then it must call it.
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question com.enthuware.oce-ejbd.v6.2.528
For option 4's explanation "In 3.x, the container calls @PostConstruct method, in which the bean can initialize itself."
I think it can be more specific to say "the container calls @PostConstruct method, in which the bean can initialize its instance variables."
I think it can be more specific to say "the container calls @PostConstruct method, in which the bean can initialize its instance variables."
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.oce-ejbd.v6.2.528
An object's state is in its instance variables so both mean the same thing.himaiMinh wrote:For option 4's explanation "In 3.x, the container calls @PostConstruct method, in which the bean can initialize itself."
I think it can be more specific to say "the container calls @PostConstruct method, in which the bean can initialize its instance variables."
But if you want to split hair, then what you are saying is not correct

Initializing a bean implies that you are setting those variables to values that make more sense from the business logic perspective. For example, int rate; would be initialized to 0 by default anyway. But the bean may want to set it to some other value. This is a bean initialization and not just instance variable initialization.
HTH,
Paul.
Who is online
Users browsing this forum: No registered users and 27 guests