Glenn has posted 7 posts at DZone. View Full User Profile

Dynamic Distributed Data Clustering on OSGi

12.15.2008
| 6657 views |
  • submit to reddit

If you’ve followed some of my past posts you’ll notice I try to keep my examples small and as simple as they need to be. If I were to describe my programming style its very much back to basics and I’m a huge proponent of simplicity.

I’ve whipped up a small example of how you can distribute data dynamically on OSGi using Hazelcast 1.4. I’ve really only scratched the surface of what you can do with this but thought I’d write up my first experiences with this light weight simple yet powerful framework.

Running the Example.

Download the cluster.zip example source code from:

https://sourceforge.net/project/showfiles.php?group_id=228168&package_id=302726&release_id=647048

Unzip the cluster.zip and start up 2 instances of eclipse 3.4. Open up the node01 and node02 directories in different instances of eclipse.

Click run light weight cluster in both instances of eclipse and Jetty should start up on port 9091 and 9092.

Open up two web browsers and in the first browser paste the following URL which will set cVal in a distributed Map on the first node.

http://localhost:9091/sample?cVal=Glenn

In the second browser paste the following:

http://localhost:9092/sample?check=true

If you see the following you have successfully setup a dynamically distributed data cluster.

Where’s the magic?

If you have a look at SampleServlet.java the magic is on line 27 and 32 where we get the map and set a value. Hazelcast makes it look like we are dealing with an ordinary map but the reality is that it possesses extraordinary distributed capability.

If you have any questions on the demo feel free to drop me a line (glenn.galang@gmail.com) or head on over to hazelcast.com.

 

From: http://ggalangblog.blogspot.com/

Published at DZone with permission of its author, Glenn Galang.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)