• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I am close to submit - question about rmi

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am using RMI as follows (I am using jdk1.5.0_07)

//Create the registry
Registry registry = LocateRegistry.createRegistry(1099);

//Obtains the stub for the registry on the local machine
registry = LocateRegistry.getRegistry();

//Exports the remote object
Data db = new Data("server");
RmiInterface dataStub = (RmiInterface) UnicastRemoteObject.exportObject (db, 0);

//Bind the remote object's stub in the registry
registry.bind("Server", dataStub);

The client has to connect first to the server before being able to query the database, the connection to the server is done like that:

//Obtains a stub for the registry on the server's host
Registry registry = LocateRegistry.getRegistry(serverName, 1099);

//Looks up the remote object's stub by name in the registry
dataRmi = (RmiInterface) registry.lookup("Server");

-On the other hand, it was mentioned in the Assignment that:

-You must not require the use of an HTTP server.
-You must not require the installation of a security manager.
-You must provide all classes pre-installed so that no dynamic class downloading occurs.
-You must use RMI over JRMP (do not use IIOP)

-does the way I used RMI fit with all the Assignment specs?
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. What you do fulfills the requirements.
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hallo,

I am not an RMI expert but the export the remote object is ready necesary ?


Data db = new Data("server");
RmiInterface dataStub = (RmiInterface) UnicastRemoteObject.exportObject (db, 0);



Regards,Mihai
 
Oliver Weikopf
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it seems not to be necessary. I don't do it either.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe it is unnecessary only if your remote implementation class is extended from UnicastRemoteObject. It this case, the exporting is done by UnicastRemoteObject's constructor. If your class does not extended from UnicastRemoteObject, you then need to manually export it.
 
Ranch Hand
Posts: 284
Netbeans IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

-does the way I used RMI fit with all the Assignment specs?


Provided information is insuficient regarding:

-You must provide all classes pre-installed so that no dynamic class downloading occurs.

You are close to submit... I supose those magic literals in your code are only for the example purpose, not?

Regards, Oricio
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic