• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

RMI Basic Concepts 03

 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Javini,

Originally posted by Javini Javono:
This question concerns specifying a unique client identifier "the easy
way."
...
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.


There used to be a TV show called "Name That Tune." On this show the contestants would compete against each other to name a particular tune in the fewest number of notes. The contestant would say: "I can name that tune in 5 notes." Another would say: "I can name that tune in 4 notes." And so on. Whoever bid the fewest number of notes got the first chance to "Name That Tune," and if they were correct they won.
In that spirit I would say I think you can accomplish your goal with only one interface and therefore only one remote object need be placed in the RMI registry. I would go with IndependentDataInterface.
Let's say the IndependentDataInterface has all the database operations required by the Sun-supplied interface. Let's further assume that it has the following method:

Then the client-side code might look something like this:

So, what do you think? Can you name that tune using only one interface and one remote object?
Hope this helps,
George
 
Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi George,
Here's a re-write as you requested using one remote interface.
Thanks for your advice.
I'll skip the connection factory for now (but, when I redo
my toy server, I'll remember to do the connection factory
not as a remote object).
Client Side (pretty much how you gave it above):

Server side:

Thanks,
Javini Javono
 
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic