how to send data from one java program to another
We have a use case to:
- start开发者_如何转开发 a java program from another java program.
- Once the second java program is invoked, send a data-stream from the first java program to the second.
I checked that we can use sockets/rpc for it. I also saw that RMI/web-services are available and now confused with everything.
Could somebody point me to some good documentation about how to do this ?
Thanks in advance
RMI is going to be your simplest choice here (2 java programs running on the same box). streaming data over rmi is not straightforward, however i've written the RMIIO library which makes that fairly easy.
I've not come to use it myself, but I think Terracotta (more precisely the distributed cache) may serve your needs (and provide much more).
Quoting from Clojure + Terracotta = Yeah, Baby! (emphasis is mine)
Terracotta provides a network-attached, virtual, persistent heap and transparent inter-JVM thread coordination. With Terracotta, you no longer need to map your objects to database tables and back. You simply hand your object to Terracotta and it will cache your data. Not only does it cache your data, but it will make your object available to a cluster of networked JVMs.
精彩评论