About Question enthuware.oce-ejbd.v6.2.374 :
Moderator: admin
About Question enthuware.oce-ejbd.v6.2.374 :
In the @PostConstruct method, there is a spelling error:
System.out.println("SSB inited");
should be
System.out.println("SSB iniated");
System.out.println("SSB inited");
should be
System.out.println("SSB iniated");
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.374 :
I think "inited" is actually a common abbreviation for "initialized", which is what the author intended. This is similar to init() method, which is quite common and is short for initialize().
If you like our products and services, please help us by posting your review here.
Re: About Question enthuware.oce-ejbd.v6.2.374 :
Just one remark,
Explanation:
Since the bean does not contain @Startup annotation, the container may or may not initialize the bean at the time of deployment. If it does initialize the bean, SSB created and SSB inited will be printed. If it does not initialize the bean during the startup, there will be no output until a client calls the bean method.
In this case, 2 answers are possible,
No message from the bean
Option a, b, and d.
It's not better to change this single in a multiple choices (2) ? Or add the @startup in the question
Thank's in advance
Explanation:
Since the bean does not contain @Startup annotation, the container may or may not initialize the bean at the time of deployment. If it does initialize the bean, SSB created and SSB inited will be printed. If it does not initialize the bean during the startup, there will be no output until a client calls the bean method.
In this case, 2 answers are possible,
No message from the bean
Option a, b, and d.
It's not better to change this single in a multiple choices (2) ? Or add the @startup in the question
Thank's in advance
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.374 :
Option d covers the condition that you are referring to. But I agree that the options can be reworded to make them clearer.
Fixed.
thanks for your feedback!
Fixed.
thanks for your feedback!
If you like our products and services, please help us by posting your review here.
-
- Posts: 22
- Joined: Thu Jul 25, 2013 3:39 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.374 :
This question can have only one correct answer. The reasons are:
1. We have to do with a Singleton Bean without any start-up information
2. There are no other beans or clients that are using this Singleton, without this the container has no reasons to initialize this bean.
With this arguments I think that only "No message from the bean" is the correct answer.
The answer "SSB created followed by SSB inited" can occur only if a client or an other ear application is calling any methods on the singleton.
More, the question limits the time range for the test scenario on the short moment after the deployment, the probability that a someone does a call on the singleton bean is extremely reduced.
IMHO this question can have only one valid answer.
This post is similar with the upper one (originated from user named Guest).
Best Regards
Mihai
1. We have to do with a Singleton Bean without any start-up information
2. There are no other beans or clients that are using this Singleton, without this the container has no reasons to initialize this bean.
With this arguments I think that only "No message from the bean" is the correct answer.
The answer "SSB created followed by SSB inited" can occur only if a client or an other ear application is calling any methods on the singleton.
More, the question limits the time range for the test scenario on the short moment after the deployment, the probability that a someone does a call on the singleton bean is extremely reduced.
IMHO this question can have only one valid answer.
This post is similar with the upper one (originated from user named Guest).
Best Regards
Mihai
-
- Posts: 26
- Joined: Fri Jul 06, 2012 1:08 am
- Location: Poland
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.374 :
I think that answer
Note that it is not specified that container invokes the newInstance only after the call from client. It is up to the containter to instantiate Singleton bean.
The second option as you see is configured timeout callback method but it is not specified in Singleton bean form question.
J
is correct because of this sentence from specification (4.8.1):SSB created followed by SSB inited
AlsoBy default, the container is responsible for deciding when to initialize a Singleton bean instance. However, the bean developer can optionally configure the Singleton for eager initialization
* A singleton session bean instance’s life starts when the container invokes the newInstance method on the session bean class to create the singleton bean instance. [...]
* The singleton bean instance is now ready to be delegated a business method call from any client or a call from the container to a timeout callback method.
Note that it is not specified that container invokes the newInstance only after the call from client. It is up to the containter to instantiate Singleton bean.
but it's not prohibited to do so, for example due to performance reasons.mopuffus wrote:without this the container has no reasons to initialize this bean
The second option as you see is configured timeout callback method but it is not specified in Singleton bean form question.
J
-
- Posts: 22
- Joined: Thu Jul 25, 2013 3:39 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.374 :
kezman9, you are right, the container decides when the Singleton is init (at least according with the specs).
Thanks for your answer,
Mihai
Thanks for your answer,
Mihai
-
- Posts: 1
- Joined: Sun Sep 14, 2014 6:25 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.374 :
I coded an example and got "No meesages from the bean" and "Only SSB Created" as the correct answers.
There is no way SSB Inited could be an output
According to specs 4.3.4Session Bean Lifecycle Callback Interceptor Methods " The PostConstruct callback invocations occur before the first business method invocation on the bean. This is at a point after which any dependency injection has been performed by the container."
Clearly states that if there is no any business method invocation Postconstruct is not invoked
There is no way SSB Inited could be an output
According to specs 4.3.4Session Bean Lifecycle Callback Interceptor Methods " The PostConstruct callback invocations occur before the first business method invocation on the bean. This is at a point after which any dependency injection has been performed by the container."
Clearly states that if there is no any business method invocation Postconstruct is not invoked
-
- Posts: 2
- Joined: Sun Nov 09, 2014 10:49 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.374 :
I think the wording of this question is very confusion. I was stuck for a few minutes how any 2 answers could be valid at the same time. Only in the review I realized that they weren't true at the SAME time...
Maybe an answer like "Cannot determine output" would be better instead of 2 contradicting answers both being correct?
Maybe an answer like "Cannot determine output" would be better instead of 2 contradicting answers both being correct?
Who is online
Users browsing this forum: No registered users and 56 guests