Hi,
This question concerns specifying a unique client identifier "the easy
way." By that, I mean such as assigning each client a unique
Java long number. Any code examples are not meant to be production quality.
Let us assume that the software will not address multiple database
file tables (as it is assumed that appropriate changes could be made
to handle this case).
We will define the following three remote objects which, ultimately,
directly or indirectly, implement the following interfaces:
The above three objects would be in the RMI registry, probably placed
there by the server application which is a separate application.
The client-side code looks something like this:
I assume the above is conceptually correct?
Now the only thing I didn't understand in some of the posts is why
people were thinking about using random numbers.
I don't think we need to worry about speed issues when the unique
ID is created on the server. Thus, the following server code,
should not lose any points due to its lack of concurrency:
And the server's connectionImpl might look something like this:
All in all, giving each client a unique ID, as long as that darned
client doesn't call connection.getId() twice, seems relatively
straightforward.
The above code is conceptual, it does not pretend to deal with the
intricacies of how you actually go about setting up a remote object
and how you set up the hierarchies of interfaces and the like, but
hopefully I have expressed myself clearly enough.
So, the above is a question, in that it is what I assert to be
true, but would appreciate correction if it is incorrect in some
fundamental way.
Thanks,
Javini Javono
[ February 05, 2004: Message edited by: Javini Javono ]