in my RMI server object, i use a HashTable to manage session objects
which allow to set/get a session-ID, some 'session values' and other
things for each connected client.
Do i have to make the getSessionValue / setSessionValue methods
synchronized or does RMI synchronize the access to these server methods
somehow "automagically"?
Thanks in advance!
Mike
unfortunately no automagical capabilities (by default) in RMI.
If multiple RPC requests arrive at the RMI server concurrently for the
same RMI object then there will be concurrent invocations on that
object. That is, RMI server-side logic does not serialize (in the sense
of allowing only one through at a time / viz. transaction serialization)
the RPC method invocations it receives. I believe this is the
automagical functionality you were hoping for.
One approach to resolve this would be to simulate
invocation-serialization by limiting the number of service threads RMI
will use to just one. Then there would only ever be one call active in
the server. However, this would severely restrict the server's ability
to scale to handle more than one client, so this approach isn't recommended.
A better approach is to protect those data structures in your
application which are not designed for concurrent access with
synchronization blocks, etc. This is what you correctly assumed.
rgds,
Brenton
--
Brenton Camac
Consultant
Camac IT Ltd
> If multiple RPC requests arrive at the RMI server concurrently for the
> same RMI object then there will be concurrent invocations on that
> object.
Instead of one remote RMI object on the server which is shared by all
clients, i could create a factory method in the server which creates one
server-side RMI object for every client. So this object would be used
exclusively by the client who creates and holds a reference to it? Could
be simple to implement and use.
Michael
Thanks
Mo
"Michael Justin" <michael...@postkasten.de> wrote in message
news:4125...@newsgroups.borland.com...
> Sorry guys but I did not get the reply to this question! Could you
> let me know the answer too?
The best thing to do is to check the archives
to see whether anyone answered the question.
If not, it could be that no one really has
a good answer.
--
Paul Furbacher (TeamB)
Save time, search the archives:
http://www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.