Solved

Load balancing in rmi

Posted on 2000-04-24
3
449 Views
Last Modified: 2013-12-29
Hello,
Suppose a rmi server is running and an object is instantiaated. now clients over internet can invoke methods on that object. when number of hits is low then it's ok. but when it's huge things may not work as desired. so i want to load balance. may be, more than one rmi server will be running and some one will decide which server to contact to. Is there any statnadard method to do it? any tool which can help it?
0
Comment
Question by:dipak_kr_ghosh
  • 2
3 Comments
 
LVL 3

Expert Comment

by:ovidiucraciun
ID: 2743273
You can do that on your server.
You build an dispacther server that only forward messages to child servers that do the task. When last child server created is to busy then it will create another one (with another thread of execution of course) and schedule the task to the new child server. And so on ...
0
 

Expert Comment

by:sajal_s
ID: 2743331
In Java1.2 one option is there i.e
Step 1:
Make the appropriate imports in the implementation class
import java.rmi.*;
import java.rmi.activation.*;
Step 2:
Extend your class from java.rmi.activation.Activatable

public class ActivatableImplementation extends Activatable
    implements examples.activation.MyRemoteInterface {

Step 3:
Declare a two-argument constructor in the implementation class
public ActivatableImplementation(ActivationID id, MarshalledObject data)
    throws RemoteException {
    // Register the object with the activation system
    // then export it on an anonymous port
    super(id, 0);
}

Step 4:
Implement the remote interface method(s)

public Object callMeRemotely() throws RemoteException {
    return "Success";
}



run rmid (rmi deamon) on server machine

This process uses the concept of lazy activation .
0
 

Accepted Solution

by:
sajal_s earned 100 total points
ID: 2743333
In Java1.2 one option is there i.e
Step 1:
Make the appropriate imports in the implementation class
import java.rmi.*;
import java.rmi.activation.*;
Step 2:
Extend your class from java.rmi.activation.Activatable

public class ActivatableImplementation extends Activatable
    implements examples.activation.MyRemoteInterface {

Step 3:
Declare a two-argument constructor in the implementation class
public ActivatableImplementation(ActivationID id, MarshalledObject data)
    throws RemoteException {
    // Register the object with the activation system
    // then export it on an anonymous port
    super(id, 0);
}

Step 4:
Implement the remote interface method(s)

public Object callMeRemotely() throws RemoteException {
    return "Success";
}



run rmid (rmi deamon) on server machine

This process uses the concept of lazy activation .


0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exchange and Third Party application. 8 59
bunnyEars2 challenge 6 68
strDist challenge 35 84
ArrayIndexOutOfBoundException 9 33
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now