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

Moderator: admin

Post Reply
ETS User

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

Post by ETS User » Tue Apr 19, 2011 3:14 am

In the @PostConstruct method, there is a spelling error:

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

should be

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

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

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

Post by admin » Tue Apr 19, 2011 5:38 am

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.

Guest

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

Post by Guest » Tue Apr 19, 2011 6:05 am

Ok then, my bad :-)

Guest

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

Post by Guest » Sat May 14, 2011 12:57 am

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

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

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

Post by admin » Sun May 15, 2011 7:08 am

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!
If you like our products and services, please help us by posting your review here.

mopuffus
Posts: 22
Joined: Thu Jul 25, 2013 3:39 pm
Contact:

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

Post by mopuffus » Thu Aug 01, 2013 10:29 am

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

kezman9
Posts: 26
Joined: Fri Jul 06, 2012 1:08 am
Location: Poland
Contact:

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

Post by kezman9 » Fri Aug 02, 2013 4:07 am

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

mopuffus
Posts: 22
Joined: Thu Jul 25, 2013 3:39 pm
Contact:

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

Post by mopuffus » Fri Aug 02, 2013 10:11 am

kezman9, you are right, the container decides when the Singleton is init (at least according with the specs).

Thanks for your answer,
Mihai

argranados
Posts: 1
Joined: Sun Sep 14, 2014 6:25 pm
Contact:

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

Post by argranados » Sun Sep 14, 2014 6:36 pm

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

ToineS
Posts: 2
Joined: Sun Nov 09, 2014 10:49 am
Contact:

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

Post by ToineS » Sun Nov 09, 2014 10:57 am

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?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest