aspose file tools*
The moose likes Distributed Java and the fly likes Deigning the MultiServer Environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Deigning the MultiServer Environment" Watch "Deigning the MultiServer Environment" New topic
Author

Deigning the MultiServer Environment

Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 239

Hello Guys,
I am trying to do a project, which involves a Multiserver Environment.
It is as follows:-
1.Client generates a Number and sends it to the RMI Server

2.Now that RMI Server should be connected to another 4 or 5 RMI servers which involves the Remote interface implementation.

3.All those 4 to 5 servers will be having Remote Interface Implementations.
4.Now, Client should not know that RMI Server is connected to another 4 to 5 servers!!!
5.The RMI Server which the client sends the request to should check the free memory in the 4 to 5 servers and send that number to whichever server is having more free JVM memory!!!
6.Now, whichever server handles this number will check that number, and return whether or not that number is prime or not directly to the client and not that main RMI SERVER!!!

Here is what I did!!!

Remote Interface


Server Program:


PrimeNumberChecker



Number Generator:



PrimeStack:



Prime Client



This works fine, the client Generates ten random number, push those number into stack, pops one by one and sends that to the RMI Server,This RMI Server itself checks whether that number is prime or not!!!

But what I Want is:

Now that RMI Server should not check for Prime Number,
This RMI Server should be connected to another 4 or 5 RMI servers which involves the Remote interface implementation.

All those 4 to 5 servers will be having Remote Interface Implementations.
Now, Client should not know that RMI Server is connected to another 4 to 5 servers!!!
The RMI Server which the client sends the request to should check the free memory in the 4 to 5 servers and send that number to whichever server is having more free jvm memory!!!
Now, whichever server handles this number will check that number, and return whether or not that number is prime or not directly to the client and not that main RMI SERVER!!!


I tried a lot, but am not getting any clue of how should I design the above scenerio,

Please Help Me!!!
Help is always appreciated!!!





PANKAJ SHET
B.Sc.(I.T.), S.C.J.P., S.C.W.C.D., PGDAC(CDAC)
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

You can not do this if you are trying to do it in a single RMI call.
An RMI call is just like calling a method on a simple java instance. Just like the method that was called can only return the result and not some other instance, similarly, some other server can not return the result to the client.

However, you can do this, if you follow an asynchronous processing model i.e. the client leaves the request to the server, the server returns saying "Result will be delivered in a short while".
The client also has an open port (or a messaging queue) where in the server can publish the reply. When the server processing is completed, the server can publish the result to the port or the messaging queue.


apigee, a better way to API!
Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 239

Hello sir,
Thanks for your reply.
But still I am not able to get the Answer!!!

what I want is :-
1) Client sends a number to an RMI Server.
A sends a number to B

2)There will be some no of other servers connected to that RMI Server.
How will RMIServer establish connection to other servers or vice-versa.

I think Socket Connection.
how will RMIServer receive connection request from any other server??

B will have some other servers connected to it, C,D,E,F
At this point of time, B do not know how many servers are connected to it.


3)Now, when Client sends a number to the RMI Server, the RMI Server will keep that number somewhere.
Serialization will do that??

A sends the number 3 to the B, B will keep that number somewhere,B will serialize it in some file??

4)Now,the RMIServer has to know how many other servers are connected to it.
how will that RMIServer come to know how many servers are connected to it??

B has to know how many servers are connected to it.
how is it possible for B to know how many servers are connected to it??

I think every other server who wishes to connect to that RMIServer (B) should be made to register themselves alongwith their Host IP and Port numbers in an XML file.

This XML file should be with B. but then how should those servers be forced to register themselves with an XML file which is with B??

Once those servers register into XML file, RMIServer will lookup into the XML file, and count the registered IP's
but to perform this lookup I will have to create an object of that XML file?

how to create that object?after doing this how will I iterate through every registered IP's so that B will come to know how many servers are connected to it??

5)After knowing that, RMIServer(B) will establish a socket connection with each of those registered servers,and calculate the free JVM memory on each of the servers connected to it


6)After calculating the free JVM Memory, RMIServer(B) will deserialize that number(3) and send that to whichever server has more free jvm memory!!!

7) Once the RMIServer(B) sends that number(3) to that other server, RMIServer's(B's) task is over.

8)Now that other Server will take that number(3), check whether it is prime or not and return the result directly to client(A) and not to the RMIServer(B).


how will that be possible??Please Help me!!!
Help is Always Appreciated!!!
Thanks A LoT!!!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deigning the MultiServer Environment