Page 1 of 1

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

Posted: Tue Apr 19, 2011 3:14 am
by ETS User
In the @PostConstruct method, there is a spelling error:

System.out.println("SSB inited");

should be

System.out.println("SSB iniated");

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

Posted: Tue Apr 19, 2011 5:38 am
by admin
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().

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

Posted: Tue Apr 19, 2011 6:05 am
by Guest
Ok then, my bad :-)

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

Posted: Sat May 14, 2011 12:57 am
by Guest
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

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

Posted: Sun May 15, 2011 7:08 am
by admin
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!

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

Posted: Thu Aug 01, 2013 10:29 am
by mopuffus
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

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

Posted: Fri Aug 02, 2013 4:07 am
by kezman9
I think that answer
SSB created followed by SSB inited
is correct because of this sentence from specification (4.8.1):
By 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
Also
* 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.
mopuffus wrote:without this the container has no reasons to initialize this bean
but it's not prohibited to do so, for example due to performance reasons.


The second option as you see is configured timeout callback method but it is not specified in Singleton bean form question.

J

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

Posted: Fri Aug 02, 2013 10:11 am
by mopuffus
kezman9, you are right, the container decides when the Singleton is init (at least according with the specs).

Thanks for your answer,
Mihai

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

Posted: Sun Sep 14, 2014 6:36 pm
by argranados
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

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

Posted: Sun Nov 09, 2014 10:57 am
by ToineS
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?