Update deleted objects

The presence of two objects A , B of the same class (for example, HashMaps).

On different computers connected via the Internet

One ( A ) is the source, and the other ( B ) is like an updated copy ...

Is there a standard / recommended way to keep them “connected” or “updated”?

Example

I am using a TCP connection and writeObject

ObjectOutputStream bufferObj = new ObjectOutputStream (out);

bufferObj.writeObject (A)

and in the copy - something like this

ObjectInputStream bufferObj = new ObjectInputStream (in);

Object B = bufferObj.readObject ();

But this has a problem that the whole object is sent in every synchronization (e.g. periodically or every time a change occurs)

I would like to send only the differences (especially useful for Java collections) , but knowing the difference is not so simple:

I would like to have something like this (too simple / optimistic scheme)

In server source

ObjectA.serverUpdatesWarehouseAt (port);

In client copy

ObjectTemp.updateItRemotelyFrom (IP, port);

ObjectB.merge (ObjectTemp); // update differences when adding / removing as needed

Is something like this already done? so I'm here trying to avoid the ingenuity of the wheel

thank you for reading

+4
source share
3 answers

It looks like you could use a distributed hash map ( http://en.wikipedia.org/wiki/Distributed_hash_table ).

There are quite a few frameworks that provide this functionality - http://code.google.com/p/hazelcast/ is one example.

At the risk of indicating the obvious - if your refresh rate is high, you can use a large bandwidth while maintaining the synchronization of the two.

+1
source

If you use RMI, you may have a distributed object, so you don’t have to worry about updating it at all. When you have a link to an object (on the client), it is automatically saved in synchronization with the server object.

0
source

You could take a look at Terracotta , which does just such things. They allow you to create shared objects between JVMs that are stored in synchronization.

0
source

All Articles