• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Mock Exam question

 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Harsha,

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

Regards,

Phil.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Men call me Jim. Women look past me to this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic