• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

From Zaikin's notes

 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excerpt from Zaikin's notes:


An enterprise bean must not attempt to listen on a socket, accept connections on a socket, or use a socket for multicast. Enterprise bean instance is allowed be a network socket client.


Network socket client? Does this mean that an EJB can use java.net.Socket to send messages.
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

This is what the EJB FAQ to say on this matter:

Enterprise beans can be network socket clients, and so they can use other network resources (including other enterprise bean servers) to do their jobs. Just as with a database connection, don't hang on to open client sockets across method calls; instead, open them, communicate through the socket, and close it before returning from the method.

Thanks

Ravi
[ February 11, 2005: Message edited by: Ravindra Janapareddy ]
 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check page no 625 of HFEJB for the things which seem bad but aren't!

Reproduced here-
1. java.net.socket - a plain old client SOckets are fine. You just can't listen on a ServerSocket.

2. Extend another class from your bean class - normal java inheritance is OK for a bean class

3. Mark a bean field static and final - in fact that's the only way you're supposed to mark a static field.

Regards,
Leena
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that an EJB can send messages through Sockets but cannot listen on a ServerSocket to receive messages. My doubt was not on understanding this but on the term 'Network Socket client'. It was unclear whether it means ejb-may-use-sockets-to-send-messages. Now I understood 'Network Socket client' means 'use socket to send messages as a client'.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic