Vivian Richards

Greenhorn
+ Follow
since Jun 19, 2001
Merit badge: grant badges
For More
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 Vivian Richards

Hi,
Isn't writeRecord() in Data class need to be synchronized. ?
This is because:
1. lets say, a thread T1 wants to Add a new record
2. at the same time, thread T2 wants to modify record number 1.
Both add() and modify() methods call writeRecord() which is not synchronized.
This will result in trying to write to the file at the same time at two different places and it could corrupt the file itself.
Please let me know whether there is anything wrong in my assumption and what you think about making the writeRecord() synchronized.
I am trying to change the deprecated methods. Can anyone please give me some guidance on how to do it or point me to some place where I can read about it ?
Hi Matt,
Congrats on becoming java developer. I just have a doubt regarding the Data class. Can we change the defintion of Data class. Meaning can I do something like this ?
interface DBInterface
{}
class Data implements DBInterface
{
}
HI,
I would like to change the definition of Data class to:
interface DataInterface implements remote
{
//all public methods of Data
}
class Data implements DataInterface
{
}
Please let me know if this is allowed ? Will SUN allow me to change the class definition of Data ?
Initial Scneario:
I have my Remote server named RMIDataServer containing the Data object.
All the calls to the RMIDataServer are delegated to the Data object.
This RMIDataServer is created from a server application named FBNServer. FBNServer takes the database name as the command line argument.
Now the question:
Since the Data has two constructors, my RMIDataServer also has two constructors. The problem is with the second constructor which takes FieldInfo[] as a parameter. Since FBNServer instantiates RMIDataServer, it needs to pass this information. But how do your pass array of FieldInfo objects as input using the command line.
Please let me know what i am missing.
Thanks,
Hi Rick,
Thanks for the very detailed reply. It was very helpful. Based on your design I have a few more doubts. Hope you would find time to answer them.
1. Can you change the class definition of Data class provided by Sun and the method singatures ? This needs to be done if you have your Data class implementing the DBInterface.
2. Just for clarification, you have a remote FBN server that would contain Data class and all calls to the FBN server are delegated to the Data class. Am I right ?
Thanks once again.
Hi,
I am very confused with the local-remote Data classes implementation. I went through some of the other messages in the discussion board but it didn't help me.
My initial design looks like this:
interface DataInterface
{
//all the public methods of Data class
}
class LocalDataClient implements DataInterface
{
protected Data data;
//All the methods calls are delegated to the Data class
}
class RemoteDataClient extends UnicastRemoteObject implements DataInterface
{
protected Data data;
//All the methods calls are delegated to the Data class
}
class DataAccessor
{
DataInterface dataObj;
//Using polymorphism, at runtime, based on local or remote
dataObj = new LocalDataClient() or
dataObj = new RemoteDataClient()
}
Questions:
1. Please comment on this design. Is it right ?
2. Should the DataInterface extend Remote. In that case , should all the methods in LocalDataClient throw RemoteException eventhought they are not going to do any RMI calls ?
Thanks in advance.