Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2) JPilot Mock Exam Question - Help Needed!

 
Seenu Reddy
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When programming business methods, which technique should be avoided to ensure bean portability across all EJB 2.0 containers? Answer One.

A. Using the java.net.Socket class.
B. Using inner classes.
C. Using the 'final' modifier for fields.
D. Passing 'this' as an argument.

Tool Anser is : D
This is EJB program restriction.
According to the Qesttion it should be A is the correct answer.


Could some one can conform on the same?

Thanks,
Seenu
 
Pranav Shukla
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can use java.net.Socket for being a network client but we cannot use java.net.ServerSocket to listen for connections as a server.

Hence Option D is the only correct answer.

Refer to EJB Specification section 24.1.2 page 494-495


� An enterprise bean must not attempt to listen on a socket, accept connections on a socket, or
use a socket for multicast.

The EJB architecture allows an enterprise bean instance to be a network socket client, but it does not
allow it to be a network server. Allowing the instance to become a network server would conflict with
the basic function of the enterprise bean-- to serve the EJB clients.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic