Thanks buddy.
Actually I also using adaptor method as show below:
public interface DataRemote extends Remote, DBMain {
}
public class DataImpl extends UnicastRemoteObject
implements DataRemote {
...
private DBMain db = null;
....
public DataImpl(
String dbLocation) throws RemoteException {
db = new Data(dbLocation);
}
...
public void lock(int recNo) throws RecordNotFoundException{
db.lock(recNo);
}
}
public class Data implements DBMain{
...
}
The only difference is my adaptor class (DataImpl) are implement DBMain. As local call return Data which also implement DBMain, when main program calling either local or remote will use the Factory return difference object implement same parent class (DBMain). Example:
private DBMain connection;
...
switch (connectionType) {
case DIRECT:
connection = suncertify.direct.Connector.getLocal(dbLocation);
break;
case RMI:
connection = suncertify.remote.Connector.getRemote(dbLocation, port);
break;
}
The problem is DataImpl (remote call) which implement DBMain need throw RemoteException and compiler not allow (bcoz DBMain don't throw it).
If my DataImpl didn't implement DBMain, it work fine but I need have 2 difference module process local and remote call.
Please guide...
Thanks