Discussion:
Can I assign a ServiceID myself?
Bryan Thompson
2009-01-17 23:48:39 UTC
Permalink
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 ***@java.sun.com
John McClain
2009-01-18 02:55:44 UTC
Permalink
Post by Bryan Thompson
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)
Post by Bryan Thompson
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)
Post by Bryan Thompson
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 ***@java.sun.com
John McClain
2009-01-18 03:52:24 UTC
Permalink
Post by John McClain
Post by Bryan Thompson
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 ***@java.sun.com
Bryan Thompson
2009-01-18 11:34:56 UTC
Permalink
Great. That will simplify things for me. Thanks, -bryan
-----Original Message-----
Sent: Saturday, January 17, 2009 9:56 PM
To: Bryan Thompson
Subject: Re: Can I assign a ServiceID myself?
Post by Bryan Thompson
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)
Post by Bryan Thompson
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.
Post by Bryan Thompson
Can I generate my own using UUID.randomUUID(), convert it into a
ServiceID, and then call the alternate JoinManager ctor
that accepts a
Post by Bryan Thompson
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)
Post by Bryan Thompson
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 ***@java.sun.com
Gregg Wonderly
2009-01-18 17:43:15 UTC
Permalink
Post by Bryan Thompson
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 ***@java.sun.com
Loading...