Hi
Initially I started my project providing just one Data object to all clients. But I started to have problems with multiple clients accessing the same RandomAccessFile object(through a Services fa�ade). The problems are caused by file pointer changes leading to unexpected results. To solve this problem the first idea I came up with was syncronizing on the RAF, but I consider this approach a little bit dangerous as I'm already syncronizing on a map object which holds the locks. My project could easily end up on a dead lock. Therefore I gave up the syncronizing on RAF solution and now I'm starting to think in providing a Data instance to each client. This will certainly solve the multiple RAF accesses problem as each client will have its own Data instance and so a file pointer. But here comes the problem. How can I provide multiple Data objects, one per client, on my RMI solution?
I have an interface exposing my business methods to be accessed by remote clients:
The realization of this interface is the remote object implementation:
This class performs its task delegating the calls to a local ServicesImpl object reference which is an attribute of RemoteServicesImpl. The ServicesImpl class is the class which holds a reference to a Data object. So, by using the RMI infrastructure, multiple client requests are handled automatically, each client request has its own
thread, but the remote object is always the same and so is the Data object. Is it possible to provide a new remote object (RemoteServicesImpl ) to each client? Or all clients are handled by the same object? How can I provide one Data object to each Client?
Thank you in advance
Best Regards
Cleverson