• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Exam question

 
Harsha Jay
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers
What would be the correct answer to this question?
I think it is 2.


public synchronized void txTest(int i)
{
System.out.println("Integer is: " + i);
}

What is the outcome of attempting to compile and execute the method above,
assuming it is implemented in a stateful session bean?

Choice 1 Run-time error when bean is created
Choice 2 The method will run, violating the EJB specification.
Choice 3 Compile-time error for bean implementation class
Choice 4 Compile-time error for remote interface
Choice 5 Run-time error when the method is executed
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harsha,

As you, I think option 2 is the correct one.

Regards,

Phil.
 
Lucy Hummel
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry,

may I ask to explain me why the method violats the EJB specification? \

Is because of the synchoronized statement?

Looking forward to the explanation.
Lucy
 
Joyce Lee
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lucy Hummel:
Sorry,

may I ask to explain me why the method violats the EJB specification? \

Is because of the synchoronized statement?

Looking forward to the explanation.
Lucy


You're right. According to EJB spec, ejbs are not supposed to create/manage threads. Article on EJB restriction.

Joyce
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic