A
acamposr
Hello I know the basic things about RMI: a server object placed into
Naming and a client which can access to the server via
Naming.lookup("ServerName").
But now I want to create new remote objects and use then from the
client.
That is:
/*** Client: ***/
// First
MainServer mainServer = (MainServer) Naming.lookup("MainServer");
// Second
Session mySession = mainServer.newSession(); // mySession is a remote
object, like mainServer
....
mySession.executeTask(task); // This code runs on the server side.
How can I do that? I want to get remote objects not always calling
Naming.lookup, but getting them from another remote object.
/*** Server ****/
public class MainServerImpl extends RemoteObject implements MainServer
{
Session newSession() {
// ?????????????
}
public static void main(String[] args) {
...
Naming.rebind("//localhost/MainServer",new
MainServerImpl());
}
}
public class SessionImpl extends RemoteObject implements Session {
....
}
Naming and a client which can access to the server via
Naming.lookup("ServerName").
But now I want to create new remote objects and use then from the
client.
That is:
/*** Client: ***/
// First
MainServer mainServer = (MainServer) Naming.lookup("MainServer");
// Second
Session mySession = mainServer.newSession(); // mySession is a remote
object, like mainServer
....
mySession.executeTask(task); // This code runs on the server side.
How can I do that? I want to get remote objects not always calling
Naming.lookup, but getting them from another remote object.
/*** Server ****/
public class MainServerImpl extends RemoteObject implements MainServer
{
Session newSession() {
// ?????????????
}
public static void main(String[] args) {
...
Naming.rebind("//localhost/MainServer",new
MainServerImpl());
}
}
public class SessionImpl extends RemoteObject implements Session {
....
}