• 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

RemoteData object creation as local object

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody

I have created an adapter class and I made this class as a remote object by extending UnicastRemoteObject . I am creating an object of this class using the code below in quotes.


DBClient localConnection = new RemoteData() ;



It works just fine but if I remove the stubs and the skeleton files, it gives an error even though I am not using the stubs functionality. My question is, Is it a violation of the below rule :

In either case, the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely



Please suggest. I really need some good advice on this.

Regards
PB
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pankaja,

From memory when you instantiate a class that extends UnicastRemoteObject it exports an instance of the object using a network port (so it starts listening for a connection). A simple example of this is:The program itself is in lines 3 - 14, and all it does is create an instance of a class that extends UnicastRemoteObject.

In line 16 I check how many ports I have LISTENing - this is shown in line 17 - I have 39 ports running for one reason or another :roll:

In line 20 I start my application in the background (if you are not running in a Unix (or Unix like) machine, you could simply run the additional steps in a separate DOS window).

Now that it is running, I check how many ports I have LISTENing in line 24 - in line 25 I now see that I have 40 ports LISTENing.

As for whether allowing this networking port to start listening is going to break the requirement that networking be bypassed - it is a bit of a grey area. Technically you are not using the network, so you might get away with it. But personally I would not chance it.

Regards, Andrew
[ March 13, 2006: Message edited by: Andrew Monkhouse ]
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I avoided unexpected networking this way:
1. Created business layer object, which operates locally on the Data class
2. Created another object, which extends UnicastRemoteObject and implements the same interface that the object in 1 does. All the methods actually redirect to non-networked version of the business layer object.
3. Created a factory, which constructs either local or network business layer objects. In local mode I am guaranteed to use only non-network form. In networked form, only a network wrapper is needed (poin 2), but code is all in the non-networked version.
 
Are you okay? You look a little big. Maybe this tiny ad will help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic