Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.programmer Subject: Re: single instance Date: Wed, 16 Jan 2013 10:46:21 -0800 Organization: Canadian Mind Products Lines: 26 Message-ID: References: <50e8eb1f$0$284$14726298@news.sunsite.dk> <1i1ry0rsgaxnm$.blszeyxb737b$.dlg@40tude.net> Reply-To: Roedy Green NNTP-Posting-Host: K2Qzzs3EAqXk5RLzfhxcSw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: csiph.com comp.lang.java.programmer:21442 On Wed, 16 Jan 2013 07:28:38 -0800, Peter Duniho wrote, quoted or indirectly quoted someone who said : >> the UUID would be the port. The 16-bit port would just be an shorthand >> abbreviation for it. > >We call that, in the programming community, a "hash code". It's not >unique, and therefore not useful as an actual port ID. A hash is different. The assignment process might work with a HashMap or like a HashMap. If hashes collide you assign different 16 bit numbers. It is a dynamic process. You don't always get the same 16 bit port from the same UUID. If you are sure the port is reserved for you, you just use the 16 bit version. If not, you ask for a port reservation (good for perhaps one second) given the UUID. Then you use the 16 bit port. When you close it, the reservation disappears. -- Roedy Green Canadian Mind Products http://mindprod.com The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. ~ Tom Cargill Ninety-ninety Law