nes1983
nes1983

Reputation: 15756

How to efficiently transfer objects between machines in Java

I've got 2 JVMs running, and I'm copying a lot of objects from the first to the second, but not all in one go. The object graphs have a lot of intersections, so it would be nice if there was a way to send only the missing parts of the object graphs. I know I've once stumbled over a framework made for just that, but I can't recall the name. What would you recommend?

Upvotes: 4

Views: 1352

Answers (4)

nathaniel.camomot
nathaniel.camomot

Reputation: 280

You can try kryonet. It's a simple but efficient TCP and UDP client/server library for Java.

https://code.google.com/p/kryonet/

Upvotes: 0

anubhava
anubhava

Reputation: 785471

Not sure of there is a custom framework just for that purpose but you have several other options to transfer Java objects from one JVM to another. Some of them are:

  1. Protocol Buffers

  2. JMS

  3. Simple socket based client/server Java

  4. Thrift

Upvotes: 3

ichthuss
ichthuss

Reputation: 1

You can use Java Remote Method Invocation (RMI). It provides both remote calls and transfering serializeable objects to another machine. Of course you need some code to compare object graphs, this can be done with calculating a kind of hash of some part of object graph and calling remote object to compare remote graph with this hash.

Upvotes: 0

Peter Lawrey
Peter Lawrey

Reputation: 533660

You need to way to detect changes from the last sent data set and send instructions or how to alter the copied data to be the same.

A simple way to do this is to record every change which occurs to the original (using an interface which support this)

You can push the same changes to the second instance and "replay" them to achieve the same result.

Upvotes: 3

Related Questions