Ashwin

Greenhorn
+ Follow
since May 25, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ashwin

Hi,
The Java 2 API hints that you can do it, though I have never tried it myself. Here is a snippet from the API spec
" For Win32 platforms, the prefix of a pathname that contains a drive specifier consists of the drive letter followed by ":" and possibly followed by "\" if the pathname is absolute. The prefix of a UNC pathname is "\\"; the hostname and the share name are the first two names in the name sequence. A relative pathname that does not specify a drive has no prefix. "
Ashwin.
19 years ago
Hi,
This would work if the servlet and the EJB server are on the same machine. If they are on different machines, the ResultSet cannot be passed as it is not Serializable.
Ashwin.
19 years ago
I am in a delimma. Some facts
1. The assignment says that concurrent use of the database when booking flights from multiple clients should be provided. This means that concurrent access of different records from multiple clients has to be provided.
This implies that the methods in the Data implementation class on the server side cannot be synchronized. Otherwise concurrent access would not be possible.
THAT'S CORRECT. THE DATA IMPLEMENTATION CLASS OR THE REMOTE CLIENT WILL NOT HAVE SYNCHRONIZED METHODS.
2. The remote method request from each client to the server object is going to be as a seperate thread (most likely it is going to be from a different JVM and as per the RMI specs calls originating from different client virtual machines will execute in different threads).
This implies that the Data class on the server side needs to be made thread safe. How do we do that ?
IF YOU OBSERVE, THE DATA CLASS IS THREAD-SAFE AS ALREADY MOST OF IT'S DATA MODIFYING METHODS ARE synchronized, which is necessary.
Lets take one of the methods getRecord(int rec) . Lets say the first client wants to get the 5th record. He has to seek to the 5th record and then read it. The second client at the same time wants to read the 10th record. So he has to seek to the 10th record and then read it. If the method getRecord(int rec) is not synchronized it is possible between the time the first client seeks to the 5th record and starts reading it, the second client seeks to the 10th record. This causes the first client to read the 10th record insead of the 5th that he was supposed to. from the above arguemnt it seems that the method getRecord(int rec) needs to be synchronized.
getRecord(int) is already synchronized and needs to be as u have pointed out above.
Now I am in a delimma from discussion at (1) I conclude do not synchronize the methods while from discussion at (2) I conclude synchronize the methods.
-> The Remote Client part will not have synchronized methods to facilitate concurrent transactions but, the Data class already has sync methods which, I feel should not be changed.
Could anyone help me in removing my delimma.
For some time I felt that for each request by the client a new instance of the server side object (implementation of Data) is created and hence the seeks of one request is unrelated to the seeks of the other. But now I feel that only one instance of the server side object exists. That object is created by the server class which provides the Data service. Multiple instances of proxies (stub) to the server side object is created.
I AM NOT COMPLETELY SURE, BUT, I FEEL THERE IS ONLY ONE REMOTE OBJECT AND ALL THE CLIENT THREADS GET IS A REFERENCE VIA THE CLIENT-SIDE STUB. The stub is on the client side and thus would be 1 per remote object. So, There will not be multiple instances of the stub.
Hope this helps.
Ashwin.
thanks in advance
In my project, the following are the "relevant" parameters.
1) Inout file name.
2) Output file name
2.5) Delimiter.
3) Number of fields.
4) Names of Fields and their lengths.

The reason for the last two parameters.
I have assumed that this tool would in effect be creating a table(in DBMS) or similar to it where you will have to provide that kind of info.
Thus, using this analogy, the user would be asked to enter the number of fields, their names and their maximum length. This thus, lets the application to be extensible and could be used with any other database (with the same format) with maybe, different field names, types etc.
I have tried to make the Data Convertor as generic as possible.
Ashwin.
RMI
Hi,
RMI will take care of creation of threads to support multiple clients. But, you will have to ensure that your code is thread safe.
Ashwin.
I had a question about the Locking in the Data class.
The client locks the record, makes the transaction and then unlocks the record. This is the normal case if everything is OK. It could happen that say Client A locks the record and before he completes the transaction, Client B unlocks the record. That would give erroneous results. (Of course this can happen only through a coding error)
One way to get around this is to maintain a client tag/id with each record lock. I was considering making the Thread name(.toString()) the ID. But, RMI does not make any guarantees that it would use the same thread again for the connection. Also, cannot use the IP/DNS coz in case of a 2 connections throught a proxy server, they are same for both connections. I would appreciate any comments from you.
Ashwin.
I have just completed my assignment and am about to submit it.
In my assignment, the data convertor tool has a GUI that accepts the input file name, output file name and other relevant parameters. It assumes that the flat file is in the proper format and tries to do the conversion. Personally, I believe that it should not make a difference if the tool is GUI-based or command line. Only minor advantage the GUI has is that it looks better and presentable.
"Will you be able to use this tool to write your deleted records back to your flat file later in the project, or will you have to open up the tool to delete unwanted records??? That sounds confusing?"
I am not able to understand the above. Could you elaborate? As far as I know, you do not need to delete any records from the flat file at any stage of the project. Correct me if I am wrong.
Ashwin.
Hi,
I am developing the assignment for the Developer Assignment(Fly By Night Services). In the description of the assignment, it is stated that :-
"The Remote Client class has to implement all the public methods of the suncertify.db.Data class".
The Data class has public methods for locking and unlocking the
records.
1) Does this mean that the client will have to remotely lock the record when a updation has to be made? This indeed is possible
but, wouldn't it be a better idea to do the locking at the server end so that there are less network calls and also the locking mechanism can be maintained efficiently.
I am stuck at this point and would appreciate any comments from
members who are currently developing the assignment.
Thanks
Ashwin