• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abt Question from Success Guide

 
Robert Wright
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a sample question from Sun's Certification Success Guide posted on their web site.
A shipping company is building an enterprise system to track the location of packages. One part of the tracking system is a network of wireless inventory devices. The devices can only be accessed using a custom, synchronous TCP/IP protocol. How should you encapsulate interaction with the wireless inventory system?
A. with a Java class that uses a JMS to interact with the inventory system
B. with a distributed CORBA object that uses IIOP to interact directly with the inventory system
C. with an EJB stateful session bean that uses Java sockets to interact with the inventory system
D. with an EJB entity bean that uses container-managed persistence to encapsulate the inventory system
The guide indicates that "C" is correct.
I might have missed this one on the test. Answer "C" indicates that the bean is listening for socket connections. Several documents indicate that listening for socket connections in a bean is a no-no. Would the bean even compile? The other answers are flawed as well. JMS just adds complexity and doesn't gain us anything.
The way I would build it is that I would set up a separate process whose job it would be to listen to the wireless devices and feed their information to a stateless session bean. The outside process would have the job of listening for socket connections, "objectifying" the data that came in and making the call on the stateless session bean.
Does anyone else think this question is flawed? Am I missing anything?
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is just another case of choosing the "best" answer. The important thing to remember is that the best answer of the four may not be the best solution to the problem.
This question also goes to illustrate that sometimes you have to break spec. Sometimes the benefit of breaking the specification out weighs the disadvantages.
Answer Breakdown
A. with a Java class that uses a JMS to interact with the inventory system
This answer obviously flawed from the get-go since JMS is asynchronous and the question explicitly states the the system only communicates synchronously.
B. with a distributed CORBA object that uses IIOP to interact directly with the inventory system
This is also not a possible answer. IIOP runs over TCP/IP but we are restrained to using a custom TCP/IP protocol which surely is not IIOP or they would have said so.
C. with an EJB stateful session bean that uses Java sockets to interact with the inventory system
This answer is technically possible but the drawback is that it breaks a restraint in the EJB Specification.
D. with an EJB entity bean that uses container-managed persistence to encapsulate the inventory system
This answer is just absurd. No vendor supports this type of functionality.
So we are left with C. For better or worse. You ask if this will compile? Sure. Vendors don't try to enforce these areas of the spec. They are the "use at your own risk and don't cry to us if they break" areas.
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Several documents indicate that listening for socket connections in a bean is a no-no.


Which documents are you mentioning?
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Section 23.1.2 of the EJB 2.0 Specification.

An enterprise bean must not attempt to listen on a socket, accept connections on a socket, or use a socket for multicast.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic