SCJP 6 [SCJP - Old is Gold]
Tim Moores wrote:
a shared DB web services (arguably a higher form of socket comm.)
Ram Narayan.M wrote:If simply want two JVMs to be communicated, RMI is the best option.
"Socket Programming" is a raw mode which has to be dealt very carefully.
William Brogden wrote:Another high level communication approach is JMS Java Message Service - which requires a separate JMS server but has the great advantage of being asynchronous.
Direct socket programming / RMI and web services require that both JVMs work together.
Shared DB, shared file, JMS permit one JVM to drop off information which the other can pick up as it is convenient.
Given that Java was developed by a company whose slogan was "the network is the computer" it is not surprising to find so many communication methods.
Bill
Bhanuprakash Sreenivas wrote:
You need to be more specific about your needs.
Like if it is a critical application , JMS would be a good choice.
Other options,
1. Avoid serialization since it will have compatibility issues .
One lightweight alternative you can explore is Google Protocol Buffers.
2 . Using a JMS should be an ideal choice based on how robust you want your applications to be.
But you need to keep in mind the following.
- Heavyweight , since it will be yet another process inbetween the two JVM process
- Need to use transactions to make it perfect.
3 . Expose as a webservice .
I also didn't understand the below line :-
Direct socket programming / RMI and web services require that both JVMs work together. Please elaborate..
William Brogden wrote:1. You don't need to buy into the full JEE to get a JMS server - see the Apache ActiveMQ project and many other open source implementations.
2. An important distinction.
I also didn't understand the below line :-
Direct socket programming / RMI and web services require that both JVMs work together. Please elaborate..
For direct socket, etc. both JVMs must be devoting CPU cycles at the same time. A transmitting socket MUST have an active receiving socket. etc.
Socket to socket will always be the fastest - harder to write or alter, harder to debug, but fastest.
Bill
Nicolo Villarete wrote:If it's JVM to JVM I would also go for RMI.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |