• Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading Class  RSS feed

 
Sandeep Advani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Recently, I read the article about Java RMI from the Sun tutorial website. As per the example; when my client gets a handle to the remote object, it sends a task (file Pi.java) which the server loads on the fly. To what I understand, loading takes place when the method is called on the remote object i.e. comp.executeTask(task) where task is an object of Pi.java and comp is the handle to the remote object.

After sending the bytecodes of Pi.java on the server, does this server load the bytecode permanently ? That means, can I write another client application which can call one of its method from outside ?

What I am looking for is writing a client which sends bytecodes on the server (server loads these bytecodes on the fly) and then have another application call this method which was loaded recently ? Trying to use RMI here....

Sandeep
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not entirely clear about all of your question, but yes, once the bytecode of a class is loaded from a remote location, it is available "permanently". This doesn't mean the reference is just hanging around permanently, you need to have some way of saving the reference just like a normal, non-distributed program. For example, you could make a remote call to a server and pass an object to the server. Inside this method, the server saves the object off in a Collection of some kind. Then, a client (could be the same client or a different one) could make a call to the server that requests the server do something with that object. The server can then pull the object out of the collection, manipulate it in some way, or even return it to the calling client.

Not sure if this is what you were asking or not... but hopefully it helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!