kill rmi server, but Naming.list still works
Hi,
i have built an rmi server program, which creates some remote objects and a program which lists them. However, the program still lists the objects after the server has shudown. Only as soon as i kill the rmiregistry, the listing stops. Why?
import java.rmi.*;
import java.rmi.server.*;
/**
This server program instantiates two remote objects,
registers them with the naming service, and waits for
clients to invoke methods on the remote objects.
*/
publicclass ProductServer2
{
publicstaticvoid main(String args[])
{
try
{
System.out.println
("Constructing server implementations...");
ProductImpl p1
=new ProductImpl("Blackwell Toaster");
ProductImpl p2
=new ProductImpl("ZapXpress Microwave Oven");
System.out.println
("Binding server implementations to registry...");
Naming.rebind("toaster2", p1);
Naming.rebind("microwave2", p2);
System.out.println
("Waiting for invocations from clients...");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
The following program lists the remote objects:
import java.rmi.*;
import java.rmi.server.*;
publicclass ShowBindings
{
publicstaticvoid main(String[] args)
{
try
{
String[] bindings= Naming.list("");
for (int i=0; i<bindings.length; i++)
System.out.println(bindings[i]);
}
catch(Exception e)
{
e.printStackTrace();
}
}
>

