File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending HashMap between 2 servers

 
victor kamat
Ranch Hand
Posts: 247
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to the area of distributed programming.

With that in mind what is involved in sending a hashMap from one server to another and keep it synchronized.
If someone can guide that would be nice.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use RMI you do not have to do anything special for sending a HashMap across from one server to another.
However, the synchronization is a little tricky as the instance of HashMap will be different for the two JVMs you can not have a single lock monitor.
If you explain in detail by what do you mean by " keep it synchronized. ", we will be able to help more.
 
Greg Bugaj
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to send Hashmap over two http servers you can use XStream serializer or as the previous poster said RMI. But still this will not take care of your synchronization.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13044
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The distributed computing solution would be to have a single instance of the hashmap shared by all applications.

What sort of activity does this hashmap have to support? How many lookups per second - how many changes per second?

Bill
 
Maris Orbidans
Ranch Hand
Posts: 149
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used JGroups for this. It's very easy to do it in JGroups.

http://www.jgroups.org/tutorial/html/ch02.html#d0e308
 
Murthy Tanniru
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to use caching you can take a look at jboss cache which internally it uses jgroups
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic