开发者

How to remotely synchronize two sets?

I need to synchronize two large sets of strings in Java, one of the on the client and the other on the server. Most pro开发者_C百科bably the client is missing a couple of entries which it should receive from the server. I don't want to transfer all members, I want to minimize the communication and the computation on the server (the client may work harder).

Any idea besides divide-and-conquer?

I'm not asking about the communication technology or alike, I'm only interested in a good algorithm. I think something like what version control does would be optimal, but I'm afraid I can't do it this way.


You can keep a generation counter for the set on the server along with a change log for each generation. The client can request all changes since the last synchronization. It can then integrate those changes and also (if applicable) send back any remaining client-side changes since the last synchronization.


you can use socket, at first synchronize all members ans then using custom methods which add and remove members in local set and send data+instruction to other end you can also use jmx active mq

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜