Hi,
I have already coded the Local database access.
The
test result is OK.
I am concentrated on the remote database access now. I have already coded the ConnectionFactory and the RemoteDataAccess.
In the ConnectionFactory, I have a method called
getDataAccessObject() which will return a new
instance of RemoteDataAccessImpl object
public RemoteDataAccess getDataAccessObject() throws RemoteException {
return new RemoteDataAccessImpl();
}
Every client gets the same ConnectionFactory object from rmiregistroy. However, every client
gets different instance of RemoteDataAccess object.
The RemoteDataAccessImpl is coded as:
public class RemoteDataAccessImpl extends UnicastRemoteObject implements RemoteDataAccess {
Data database;
public RemoteDataAccessImpl(
String dbname) {
database = new Data(dbname);
.................
}
By this way, every client actually has its own
instances of database object (Data); I believe all of the database instance objects can concurrently access the same database file (db.db). However, they are not the same instances.
There are several discussions in the forum about the remote database close. The conclusion is to release the lock instead of closing the database because the database is shared.
My question is :
Since each Data instance is independent, will the
close in one instance really affect the other client ? If the close will affect the other client, how about the openning of the database ?
Will other client get affected too ?
Thanks,
John Chien