views:

47

answers:

2

Hi StackOverflow!

I have several Beans in my Application which getting updated regularly by the usual setter methods. I want to synchronize these beans with a remote application which has the same bean classes. In my case, bandwidth matters, so i have to keep the amount of transferred bytes as low as possible. My idea was to create deltas of the state changes and transfer them instead of the whole Objects. Currently, I want to write the protocol to transfer those changes by myself but I'm not bound to it and would prefer an existing solution.

Is there already a solution for this Problem out there? And if not, how could I easily monitor those state changes in an generalized way? AOP?

Edit: This problem is not caching related even it may first seem so. The data must be replicated from a central server to several clients (about 4 to 10) over the internet. The client is a standalone desktop application.

A: 

I like your idea of creating deltas and sending them.

A simple Map could handle the delta for one object. Serialization could simply get you the effective message send.

To reduce the number of messages that would kill your performance, you should group your deltas for all objects and send them as a whole. So you could have others collections or maps to contain this.

To monitor all changes to many beans, AOP seem like a good solution.


EDIT : see Skaffmann's answer.

Using an existing cache technology could be better. Many problems could already have solutions implemented...

KLE
+1  A: 

This sounds remarkably similar to JBossCache running in POJO mode.

This is a distributed, delta-based cache that breaks down java objects into a tree structure, and only transmits changes to the bits of the tree that changes.

Should be a perfect fit for you.

skaffman
I just read the three pages concerning the POJO mode. It seems that I cannot read the deltas from the cache, can I? My problem is not caching related, so a replication among application servers does not fit my problem so well. I will edit my question to clarify this. But thanks a lot for your answer so far :)
Malax
I think this is still relevant. Caching and replication are closely related problems. Your central server can store the objects to be replicated in the cache, and the clients all get the updates to that central object. If your client applications need to be notified of changes to the model, they can register cache listener callbacks.
skaffman
Incidentally, while your problem is not a cache-related one, this solution happens to use a distributed cache technology.
skaffman