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.
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 ]
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.
subject: RemoteData object creation as local object