I implemented the factory pattern as these:
1. The FactoryImpl is registered with the rmiregistry
2. The client requests a reference to a Factory
3. The rmiregistry returns a remote reference to a FactoryImpl
4. The client invokes a remote method on the FactoryImpl to obtain a remote reference to a ProductImpl
5. The FactoryImpl returns a remote reference to an existing ProductImpl.
6. The client invokes a remote method on the ProductImpl to run a testing object's method on the server side.
Note: the FactoryImpl and the ProductImpl are remote objects. My enviroment is : Windows2000, single PC, use file url, server and client
run in two seperated DOS_like windows.
But above cann' work. If I modify the ProductImpl and the test object to implements Serializable, then it work! But the ProductImpl just works on client side instead of server side! I know the reason: the copy instead of remote reference of the two object be passed !
Problems are:
1. Must ProductImpl extend UnicastRemoteObject like FactoryImpl does?
2. Myst ProductImpl implements Serializable?
3. How should I modify it to make it work correctly?
[ October 08, 2002: Message edited by: HiBob Chu ]
1. The FactoryImpl is registered with the rmiregistry
2. The client requests a reference to a Factory
3. The rmiregistry returns a remote reference to a FactoryImpl
4. The client invokes a remote method on the FactoryImpl to obtain a remote reference to a ProductImpl
5. The FactoryImpl returns a remote reference to an existing ProductImpl.
6. The client invokes a remote method on the ProductImpl to run a testing object's method on the server side.
Note: the FactoryImpl and the ProductImpl are remote objects. My enviroment is : Windows2000, single PC, use file url, server and client
run in two seperated DOS_like windows.
But above cann' work. If I modify the ProductImpl and the test object to implements Serializable, then it work! But the ProductImpl just works on client side instead of server side! I know the reason: the copy instead of remote reference of the two object be passed !
Problems are:
1. Must ProductImpl extend UnicastRemoteObject like FactoryImpl does?
2. Myst ProductImpl implements Serializable?
3. How should I modify it to make it work correctly?
[ October 08, 2002: Message edited by: HiBob Chu ]