Amit Kr Kumar

Ranch Hand
+ Follow
since Feb 08, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Amit Kr Kumar

Hi Team
In my design i have a RMIServer.java which binds ConnectionFactory (ConnectionFactory.java) in RMI
registry. The connection factory creates and returns connections (RemoteDataAccess objects) which implkements all the public methods of Data.java
My question is what is my DataServer in my design
Actually i need to define the major components of my app in DesignChoices.txt like:
Data Server, Data Client etc
Is my Data Server constitutes of all the above three classes ???
Amit
[ August 05, 2002: Message edited by: Amit Kr Kumar ]
Hi Team
There seems to be a bug with add(DataInfo[]) method of Data.java. This method first check whether the flight number of the new record to be added already exist in the db.db. If not found it invokes writeRecord(String[] newData) method where the new values are inserted in the db and the values which has larger length than required by Data, they are truncated.
The problem is that suppose there is already a record with flight number="SINGA" in the db.db
Now if we try to add a record with flight number "SINGAPORE-27", by invoking the add() method, then it will not find the flight number "SINGAPORE-27" in database. Thus then writeRecord() method will be invoked. Now since the length of flight number string to be added "SINGAPORE-27" is larger than expected, thus it will be truncated to "SINGA" only and then inserted into database. Thus now the database have duplicate flights.
How to overcome from this probelm ???
Pls Help
I need to upload the assignment in 1-2 days
Amit
Hi team
Did anybody has provided reconnect option to the client GUI, in case server goes down while client is operating. How this can be done ??
What particular needs to be catch to detect the server has gone down???
Is it required ???

Amit
Hi Team
I am facing a strange problem on Linux Red Hat. My client GUI works perfectly fine on Windows and Solaris. However if i run it on Linux, though it runs but it also throws the following error on the prompt:
Font specified in font.properties not found
Strage thing is that i have not set any font in the GUI. I am using the default implementation of Swings.
Any solution for this ???
Amit
Thanks Mike
Amit
Hi Team
I have a doubt regarding requirement for JRE or JDK. I think server and client can run using JRE and there is no need of JDK.
However for unjarring the submission (scjda-xxxx.jar) you require jar tool which comes with JDK only and not with JRE i suppose.
So should i say machine should have JDK or should i say it should have JRE in README. ???

How others have handled this situation ???
Amit
Congratulations Robin
Amit
22 years ago
Sorry Eugene actually its a typo mistake
The correct classpath command i used is
CLASSPATH=%CLASSPATH%;c:\amit\server.jar;

So any solution ???
[ July 28, 2002: Message edited by: Amit Kr Kumar ]
Hi Max and others
I am facing a very unusual problem. I have created an executable server jar file. I placed this file in the folder c:\amit.
I am able to run it using the
java -jar server.jar from the same directory where server.jar file is lying i.e. c:\amit.
However when i go to any other directory from prompt say
cd c:\xyz (REmember server.jar is still in c:\amit)
and execute java -jar server.jar it says :

Exception in thread "main" java.util.zip.ZipException: The system cannot find the file specified
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:110)
at java.util.jar.JarFile.<init>(JarFile.java:115)
at java.util.jar.JarFile.<init>(JarFile.java:57)
I have set the classpath as well in the prompt
using the command
set CLASSPATH=%CLASSPATH%;c:\server\server.jar;
But still not working
Important thing is that i can also start the server as
java -jar <install-dir>/server.jar no matter what is my current working directory on the command prompt
1) How to solve the above problem
2) if i run the server usung java -jar <install-dir>/server.jar and don ask the client to set any classpath, will i fulfill the exam requirement
becoz the requirement says:
*******************************************
How to execute the programs. You must provide exact command-line instructions. If any environmental setup is required, do not just say what needs to be done; provide instructions on how to perform the setup. For example, do not say something like "add server.jar to your classpath". You should document exactly how to add the jar file to the classpath. Note: your program must run correctly no matter what directory it is installed in.
********************************************
Amit
Congrats Arup.
You deserve this. Best of luck for the future.

Amit
22 years ago
Hi Max

Hi Amit.
I may not be following your design, but it sounds like the client's are not allowing themselves to call unlock if they don't currently have the record. This is a clever idea, and a practical one.
However, it does not meet the requirements of the unlock method, as they were presented to me. That is, my unlock method (in the data class) required that the calls be ignored if the person attempting to unlock didn't actually own the lock. That's not what's happening in your case: in your case, your just promising that the client will not try to unlock records that they don't own. In the requirements (as I understand them), this responsibility falls on the Data class. You've deferred the responsibility to the client. It's a subtle, but important, difference.
If you decide to consider another approach here, then you'll need to provide some way for the Data class to keep track of the clients doing the locking. This will likely suggest the usage of a Map of some sort. This can be either through a ClientID, or, if each client gets their own thread, the ThreadID. I recommend the latter.


i agree with you that it should be done by Data but the problem is the lock() inside Data takes only record number as argument and nothing else.
Thus i can not pass the ClientID (RemoteDataAccess) object to this method ??
Will it be correct to modify the method signature of Data class to accomodate clientid ??
*********************************
Robin, how did u handled this situation
*********************************
Amit
Thanks Max
However in my case, i have used a hashset and not hashmap. It is with Data's LockManager and does not contain any info abt who have locked what. It just knowns what all records are locked.
I have a connection factory which is binded in connection factory and generates and give connection (RemoteDataAccess) objects to clients when its getConnection() method is called.
Every client has its own unique object.
This connection has all the methods of Data class. It keeps a record of what all records it has locked in a hashset. When lock method of this connection class is called it first class lock (rec) method of Data class where actual locking is perfomed using wait monitor and then it adds this record no in its own hashset to update itself. This is helpful in case of unlock. Thus unlock calls can be ignored if it has not locked by the same client.
Every connection known what all records it has locked.
I could have used a RemoteLockamanger which keeps record no as key and clientid as value. But i have not done that becoz for this i had to leave the lock and unlock methods of Data class empty. I do not wnat to take the chance of leaving them blank.
Is this design correct ???
Amit
Thankas Max
This means that i need to take care of single quotes in the beginning and end of the value to match and strip them off?
Am i right ???

Will there be any case when single quotes are not coming. If so, should i considred them as a valid param and skip the step of stripping them off.

I am using JDK1.3 as i started my assignment long time back with this version only and now i am going to upload it next week.

Amit
Hi Alex
What was your command line for starting the server and client ???
Did u asked the user to set some classpath as well
I am asking so as in case of executable jar file, u can not use classpath settings.
Mike you are also requested to comment on this
Amit