I am figuring out the best way to communicate with propietary software through J2EE software, in the past, we went the complicated route and created an mbean to forward traffic to different clients, but between upgrading application servers the mbean was difficult to port and stuff. I recently went with a simple SESSION bean and opened a raw socket connection to the external tcp server, and this method worked fine, but I was wondering how others did it.
The software is GIS/ArcIMS, I may want to communicate with different webservers in the future.
-
J2EE and raw TCP traffic (1 messages)
- Posted by: Berlin Brown
- Posted on: July 19 2004 10:53 EDT
Threaded Messages (1)
- J2EE and raw TCP traffic by Tomas Karlsson on July 19 2004 14:18 EDT
-
J2EE and raw TCP traffic[ Go to top ]
- Posted by: Tomas Karlsson
- Posted on: July 19 2004 14:18 EDT
- in response to Berlin Brown
I have used the same solution. Note that the stateless session bean has instance pooling, and the EJB spedification guarantees that only one thread/client uses one instance at the same time. This means you can open the socket in ejbCreate and close it in ejbRemove [section 7.8.1 in the EJB 2.1 specification].
With this design, the instance pool for statless session beans on the application server will also serve as a connection pool for your TCP/IP sockets.
Note that your bean will be non-transactional, and should be declared as "NotSupported" in the deployment descriptor.
/Tomas