开发者

Sharing objects across rmi servers using spring rmi

Am using RMI Spring capablilites and new to this framework.

In my application there is a client which access a service running on server using RMI Spring. Now, if maximum no. of users to that service connect, connection refuse exception is thrown and I am catching it and then transferring the control to another server which runs a backup ser开发者_StackOverflow社区vice and performs the same task. The task is simple. We are adding user names to an arraylist.

Problem: Arraylist to which users are getting added is local to each of the server and when control transfers to new server after exception has occured, the users get added to the arraylist which was created at the new server.

How can the same arraylist object be shared across the servers/application, so when the exception occurs or doesn't occur, program continues to add usernames in the same arraylist?

Please suggest.

Thanks.


Sharing the array among servers is not a problem you need to solve. The problem is you've chosen load balance approach which is not really correct.

It would be much better to have a component which is responsible for providing information to a client about least loaded server. It's not a client responsibility to decide which server is better to connect. The only thing client needs is a working server.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜