This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes client id for Remote Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "client id for Remote Connection" Watch "client id for Remote Connection" New topic
Author

client id for Remote Connection

Rachna Chaturvedi
Greenhorn

Joined: May 02, 2002
Posts: 21
Hi , i am going mad trying to find a way to assign the client id for my remote conenction,
can someone advise
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Rachna,
You and every other developer candidate! I remember my fretting over it. Do a search on ConnectionFactory or unique client ID and that should give you plenty of reading.
In a nutshell, if all clients are issued a unique connection, then the client ID is "this".

Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Rachna Chaturvedi
Greenhorn

Joined: May 02, 2002
Posts: 21
Hi Micheal, Thanks for your repsonse, but in my case i do not use separate connections .

I will try the search and get back ., THanks again
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Rachna,
Bummer! Then you're probably stuck with generating some sort of hash code based on remote invocation. Or you could keep a static long, that is initially set to Long.MIN_VALUE that is incremented each time a client calls lock. Of course that value will have to be passed back to the client some way so it can later call unlock with the proper bona-fides.
Hope this helps,
Michael Morris
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Hi Micheal, Thanks for your repsonse, but in my case i do not use separate connections .

Then start using them
You will find that the changes you need to make to follow this design will be quick and easy.
I also had the same situation, It took me a little while to understand the COnnection and ConnectionManager design, but when I did I immediately went to tchange all my code, and it only ended up taking about 15 minutes to do so, because the design is so elegant.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Rachna Chaturvedi
Greenhorn

Joined: May 02, 2002
Posts: 21
Hi Micheal and Mark,
Thanks for your suggestion.
I have realised that i am better of changing the design and code of connection and ConnectionManager. I now have the design clear in my mind
. But it is indeed a tricky one
Thankyou both
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Originally posted by Mark Spritzler:

I also had the same situation, It took me a little while to understand the COnnection and ConnectionManager design, but when I did I immediately went to tchange all my code, and it only ended up taking about 15 minutes to do so, because the design is so elegant.

Hi Mark!
can you help me to understand Connection and ConnectionManager, too? Maybe some reading suggestions, patterns, etc.
Thank you!


Mag
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
Originally posted by Mag Hoehme:

can you help me to understand Connection and ConnectionManager, too? Maybe some reading suggestions, patterns, etc.

I used the factory pattern to implement my ConnectionFactory.
In general the factory sat in my client and was passed the command line options that were given when the client was started up. From these options, the factory would decide which kind of DataAccess object to create (either LocalData or RemoteData). Then it would create the connection and hand it off to the client. That way the client was always dealing with the DataAccess interface and did not get cluttered up with a bunch of if-then statements for local/remote modes.
Hopefully that helps a bit...


scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
 
 
subject: client id for Remote Connection