Not Really a Blog

January 28, 2006

On Distributed Computing using RMI

Filed under: Programming, Sussex University — Tags: , — jesus @ 17:40

Ok, so I have this assignment in one of my courses at the University of Sussex, Distributed Systems. The thing is that we need to implement a distributed event notification system, in which clients subscribe themselves to the server to which some event generators sends their events.

All of this, using RMI (Remote Method Invocation) in Java.

The assignment is an introduction to distributed objects in java by implementing this little system. In it, each Event Generator, sends events to the server, made of an identification string and a message (in fact, it could be any kind of object).

On the other hand, the server get subscriptions of clients. These send the server a regular expression and a timeout, each of which would be used to choose among the different events received and to set a maximu time in which the subscription is valid. When doing so, the server sets up a callback function to the clients so, when a matching event is received, the server has a way to send the clients the object (event). I think it can be better understood by looking at the graph above.

So far, it’s been quite interesting to learn this kind of distributed framework, although java is not my kind of language. I want to do some more researh on how to do this kind of things with other languages like ruby o r python. Seems to me interesting.

Here is a little bit of the code used, just for curiosity:

public static void main(String[] args) {
	if (System.getSecurityManager() == null) {
	System.setSecurityManager(new RMISecurityManager());
	}
	try {
		EventNotificationServer server = new EventNotificationServerImpl();
		String hostName = InetAddress.getLocalHost().getHostName();
		Naming.rebind("//" + hostName + "/"
				+ EventNotificationServer.rmiName, server);
		System.out.println("EventNotificationServerImpl bound to "
				+ hostName);

	} catch (Exception e) {
		System.err.println("EventNotificationServerImpl exception: "
				+ e.getMessage());
		e.printStackTrace();
	}

}

The assignment is an introduction to distributed objects in java by implementing this little system. In it, each Event Generator, sends events to the server, made of an identification string and a message (in fact, it could be any kind of object).

On the other hand, the server get subscriptions of clients. These send the server a regular expression and a timeout, each of which would be used to choose among the different events received and to set a maximum time in which the subscription is valid. When doing so, the server sets up a callback function to the clients so, when a matching event is received, the server has a way to send the clients the object (event). I think it can be better understood by looking at the graph above.

So far, it’s been quite interesting to learn this kind of distributed framework, although java is not my kind of language. I want to do some more researh on how to do this kind of things with other languages like ruby o r python. Seems to me interesting.

Here is a little bit of the code used, just for curiosity:

public static void main(String[] args) {
    if (System.getSecurityManager() == null) {
    System.setSecurityManager(new RMISecurityManager());
    }
    try {
        EventNotificationServer server = new EventNotificationServerImpl();
        String hostName = InetAddress.getLocalHost().getHostName();
        Naming.rebind("//" + hostName + "/"
                + EventNotificationServer.rmiName, server);
        System.out.println("EventNotificationServerImpl bound to "
                + hostName);

    } catch (Exception e) {
        System.err.println("EventNotificationServerImpl exception: "
                + e.getMessage());
        e.printStackTrace();
    }
}
About these ads

4 Comments »

  1. we have the same assignment now in the same course same uni.. have you managed a solution?

    Comment by anonymous — January 30, 2010 @ 14:07

    • Dude, chill. I’ve received your other comments but I don’t have much time.

      Thing is, I don’t remember much about this and, yes, we managed a solution… 4 years ago. What about you actually do your assignment and come up with a solution yourself?

      Comment by jroncero — February 2, 2010 @ 00:29

  2. Didnt ask to give me the solution! I am not this kind of person i was just googling and thought you could help as I am helping people who are in their first year.. Thanks anw !

    Comment by anonymous — February 2, 2010 @ 17:45

  3. I really like looking through an article that can make people think.

    Also, many thanks for allowing for me to comment!

    Comment by http://www.youtube.com/Watch?v=8e81jtbrf-s — February 24, 2014 @ 15:44


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Customized Shocking Blue Green Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 2,886 other followers

%d bloggers like this: