Xiaoyan Sun

Greenhorn
+ Follow
since Feb 23, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Xiaoyan Sun

Thank you for reply, Abhijeet
My problem was solved.
12 years ago
I do want to change field using RMI. But it doesn't work. When i try to print the fingertable, it is null. I don't know where i am wrong.
12 years ago
Hi all,

I want a client to use RMI to change field value of a server.

for example,
//interface


//server


//client


I'm new to RMI. It seems that I cannot change the field of the server. But I have to use this way to update the fields of server,I mean through RMI. Can anybody give me a hint? I will appriate that.

[NK: Added code tags. Please UseCodeTags]
12 years ago
I'm sorry, Ernest. I didn't see your code clearly. You are right. They are the same, and it can work.
12 years ago
Ernest, Thank you for reply!

I got the following from Internet. The thread shouldn't be in the catch {}. I tried this quit(), it works just fine.

public void quit() throws RemoteException {
System.out.println("quit");
Registry registry = LocateRegistry.getRegistry();
try {
registry.unbind(_SERVICENAME);
UnicastRemoteObject.unexportObject(this, false);
} catch (NotBoundException e) {
throw new RemoteException("Could not unregister service, quiting anyway", e);
}

new Thread() {
@Override
public void run() {
System.out.print("Shutting down...");
try {
sleep(2000);
} catch (InterruptedException e) {
// I don't care
}
System.out.println("done");
System.exit(0);
}

}.start();
}
12 years ago
I remotely started up a RMI registry: Process p = Runtime.getRuntime().exec("ssh "+host+"; cd "+path+" ; java Server");

public class Server(){
Exit(){
System.exit(0);
}
main(){
Registry registry = LocateRegistry.createRegistry(1099);
.....
}
}

I want to using the Client to shut down the Server through RMI call. The Server implemented a method "Exit()"

public class Client{

main(){
...
Object ob =(...)Naming.lookup(url);
ob.Exit();
}

}
but it doesn't work. There is an Exception -java.io.EOFException. Can anybody tell me why ?
12 years ago