Since its inception, my project has been using DiscoveryV1 and we've never dealt with Jini constraints. Peter's comments last week about the flexibility of DiscoveryV2 inspired me to learn more about it and to experiment a bit. To my surprised, I found it very difficult to figure out how to turn V2 on (I ended up reading a lot of source code), and it looks like it's nearly impossible to migrate in a backward compatible way, i.e. continuing to fully interact with services that were deployed with the default preference for V1. I would LOVE to be told that I've made a mistake or missed something important...
* To switch Reggie to use V2 for multicast announcements: com.sun.jini.reggie { discoveryConstraints = new BasicMethodConstraints(new InvocationConstraints(null, DiscoveryProtocolVersion.TWO)); } * To switch group discovery to use V2 for multicast requests: net.jini.discovery.LookupDiscovery { discoveryConstraints = new BasicMethodConstraints(new InvocationConstraints(null, DiscoveryProtocolVersion.TWO)); } * To create a locator that uses V2 for directed unicast discovery: new ConstrainableLookupLocator(host, port, new BasicMethodConstraints(new InvocationConstraints(null, DiscoveryProtocolVersion.TWO))); * To tell DiscoveryV2 how to encode and decode the messages, create a file called "META-INF/services/com.sun.jini.discovery.DiscoveryFormatProvider" and put in lines (for example): com.sun.jini.discovery.plaintext.Client com.sun.jini.discovery.plaintext.Server However (and this is the key problem), any deployed clients or Reggies which lack the META-INF/services/com.sun.jini.discovery.DiscoveryFormatProvider file will not be able to decode the incoming messages and will drop them with an error message about unknown format IDs. So, the only solution I can see is to start shipping new services with the DiscoveryFormatProvider file in place, and then wait several releases until all of my old deployments have been retired, and then turn on the V2 preference. Am I wrong? Is there a trick to get already-deployed clients to use a format ID that they don't know about? Surely other people have had similar problems deploying brand-new DiscoveryFormatProvider implementations? Is there a way to make services send out both V1 and V2 multicasts? Is there a way to tell LookupDiscovery.UnicastDiscoveryTask to try V2 first and then retry with V1? I feel like I'm missing some central point... Chris