Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

From Zaikin's notes  RSS feed

 
Ranch Hand
Posts: 204
  • 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.
 
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 ]
 
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: 204
  • 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'.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!