Reputation: 211
I have developed an application using TCP/IP where the application is a listener. When messages arrive on a ServerSocket, the application further processes the message.
This is deployed onto a Glassfish server. This application now needs to be turned distributed meaning two instances of the application on Glassfish and data to be sent to each instance's listener on different ports. How can this be achieved ? Will there be code changes to be applied? The port number the application listens to is specified in a properties file.
Usually RMI is used, but for TCP/IP applications I am not sure.
Upvotes: 0
Views: 181
Reputation: 718826
Assuming that you've already implemented your application, and figured out how to deploy it to Glassfish, then you could potentially deploy it twice with two copies of the same WAR file (?) ... differing only in having properties files with different properties.
On the other hand, you could also change the code so that a single application runs two different listener threads that listen on the two different ports.
Either way, you need to end up with two listener threads.
Depending on which approach you take, code changes may be required.
I'm a bit puzzled as to why you are using a Java EE application server to run something that seems to be just requiring vanilla Java sockets. Does the application make use of Java EE functionality in other ways? If not, it would be better to just to leave it as a Java SE application, and run it directly using the java
command. (One or two JVMs ... as required.)
Upvotes: 1