Can I assign a ServiceID myself?

View: New views
5 Messages — Rating Filter:   Alert me  

Can I assign a ServiceID myself?

by Bryan Thompson-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hello,

I am using a non-persistent reggie.  I have been waiting to be
discovered and then taking the assigned ServiceID.  However, I am
wondering if I can assign a random ServiceID myself.  This would be an
advantage to me in an integration context where I would like to register
the ServiceID somewhere else before the service is actually started.
Can I generate my own using UUID.randomUUID(), convert it into a
ServiceID, and then call the alternate JoinManager ctor that accepts a
pre-assigned ServiceID?

It's all UUIDs.  Does it make a difference who assigns it?

Does it make a different if I am using persistent reggie?

Thanks,

-bryan

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Re: Can I assign a ServiceID myself?

by John McClain - Sun Microsystems, Inc. :: Rate this Message:

| View Threaded | Show Only this Message

Bryan Thompson wrote:
> Hello,
>
> I am using a non-persistent reggie.  I have been waiting to be
> discovered and then taking the assigned ServiceID.  However, I am
> wondering if I can assign a random ServiceID myself.

yes you can (I don't have the source handy, but I think the contributed
services work this way now)

> This would be an
> advantage to me in an integration context where I would like to register
> the ServiceID somewhere else before the service is actually started.
> Can I generate my own using UUID.randomUUID(), convert it into a
> ServiceID, and then call the alternate JoinManager ctor that accepts a
> pre-assigned ServiceID?
>
> It's all UUIDs.  Does it make a difference who assigns it?

no, just make sure you use a good algorithm to pick the UUID
(UUID.randomUUID is fine, there is also a UuidFactory class in the
net.jini.id package, also many OS have uuidgen commands)

> Does it make a different if I am using persistent reggie?

It doesn't make a difference

Hope this helps

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Re: Can I assign a ServiceID myself?

by John McClain - Sun Microsystems, Inc. :: Rate this Message:

| View Threaded | Show Only this Message

John McClain wrote:
> Bryan Thompson wrote:
>> Hello,
>>
>> I am using a non-persistent reggie.  I have been waiting to be
>> discovered and then taking the assigned ServiceID.  However, I am
>> wondering if I can assign a random ServiceID myself.
>
> yes you can (I don't have the source handy, but I think the contributed
> services work this way now)

[... John rummages through laptop looking for Jini source code ...
  emerges victorious with a beat up folder...]

When Outrigger comes up it uses UuidFactory.generate to create a Uuid
(persistent outriggers will persist this Uuid and re-use it on restart),
  and then uses Uuid for the ServiceID, as the value that defines proxy
equality Outrigger's top level proxy, admin proxy, and transaction
participant proxy, and in its leases to implement Lease.canBatch.

4DF0ECDB-D13E-48CB-9A8B-EFB95EEA9A25

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Re: Can I assign a ServiceID myself?

by Bryan Thompson-2 :: Rate this Message:

| View Threaded | Show Only this Message

Great.  That will simplify things for me.  Thanks, -bryan

> -----Original Message-----
> From: John.McClain@... [mailto:John.McClain@...]
> Sent: Saturday, January 17, 2009 9:56 PM
> To: Bryan Thompson
> Cc: JINI-USERS@...
> Subject: Re: Can I assign a ServiceID myself?
>
> Bryan Thompson wrote:
> > Hello,
> >
> > I am using a non-persistent reggie.  I have been waiting to be
> > discovered and then taking the assigned ServiceID.  However, I am
> > wondering if I can assign a random ServiceID myself.
>
> yes you can (I don't have the source handy, but I think the
> contributed services work this way now)
>
> > This would be an
> > advantage to me in an integration context where I would like to
> > register the ServiceID somewhere else before the service is
> actually started.
> > Can I generate my own using UUID.randomUUID(), convert it into a
> > ServiceID, and then call the alternate JoinManager ctor
> that accepts a
> > pre-assigned ServiceID?
> >
> > It's all UUIDs.  Does it make a difference who assigns it?
>
> no, just make sure you use a good algorithm to pick the UUID
> (UUID.randomUUID is fine, there is also a UuidFactory class
> in the net.jini.id package, also many OS have uuidgen commands)
>
> > Does it make a different if I am using persistent reggie?
>
> It doesn't make a difference
>
> Hope this helps
>

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...

Re: Can I assign a ServiceID myself?

by Gregg Wonderly :: Rate this Message:

| View Threaded | Show Only this Message

Bryan Thompson wrote:
> It's all UUIDs.  Does it make a difference who assigns it?
>
> Does it make a different if I am using persistent reggie?

It's not a problem as John says.  The simple thing to consider is that if you do
the bit stuffing yourself, you need to use enough randomization to avoid
duplicates that can exist from other services.  Remember that if a service is
authorized to register with reggie (through JERI authorization etc), then the
last service registering with a particular ServiceID wins and thats the only
instance visible.

Gregg Wonderly

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to listserv@...