0

I need to implement a proof of concept application Swing application where there's a server having a list of users and several clients which connect to the server and do CRUD operations on the database and hence on the list of users.

client application example

I have an obvious synchronization dilemma of keeping all clients lists updated so that if one client removed a user another one who still has it in his list cannot change its name. Now I know a protocol in which before updating a user the client asks the server whether it still exists would work.

However this is just a simple example but in the real application I might have junction tables and complex references between objects which need always to be kept consistent and I don't want to reinvent the wheel.

What I'm wondering if there's some ready made solutions or some library which does this job which doesn't require me to change database or load extremely complex dependencies.

I did some research on Google but nothing seems to fit and the most similar example of client server synchronization I found was "chat programs", however chat programs are inherently simple because a message is never modified or deleted and all you have to keep consistent is the chronological order. I would need something more involved than that or some useful hints on the subject.

4

1 回答 1

0

您需要的是服务器和客户端之间的某种消息传递。客户端要么长轮询服务器,请求更新,要么订阅服务器上的某些流媒体端点。

您可以查看Comet模型、长轮询本身、websockets等。

或者 - 有几个数据管理服务 - BlazeDSGraniteDS或任何类似目的的解决方案。您可以将其中之一集成到您的应用程序中并用于完整的数据管理周期。

于 2013-04-19T12:12:42.140 回答