Only thing is, people do occasionally use unicast discovery. For instance, the Amazon cloud doesn’t support multicast (that may have changed since I looked into it). So in those cases, if you can’t come up on the chosen port, it is actually a failure.
So I’d make the automatic failover feature optional, disabled by default. Seems like it’s primarily an issue in the integration tests. Cheers, Greg. On Feb 21, 2014, at 7:38 PM, Peter Firmstone <peter.firmst...@zeus.net.au> wrote: > I'm currently getting a number of test failures where a port passed in by > configuration is already in use. If the port specified is 0, then an > arbitrary port is selected if 4160 is not available. > > However Reggie throws an exception during construction if a configured port > is in use. > > I'd like to change Reggie to use an arbitrary port if a configured port is in > use, this then allows an admin to try a range of ports, using DiscoveryAdmin, > so a port in use failure isn't terminal, but instead a minor inconvenience. > > Regards, > > Peter. > > net.jini.discovery.DisoveryAdmin states: > > /** > * Changes the number of the port on which the lookup service is currently > * listening for unicast discovery queries to the given port number. > * If a value of zero is input, then the lookup service will first try > * to listen on the standard unicast discovery port, but if that fails, > * the lookup service will listen on an arbitrary port. > * > * @param port <code>int</code> representing the new port number on which > * the lookup service should listen for unicast discovery > * queries. > * > * @throws java.io.IOException because an invocation of this method will > * result in the re-initiation of the unicast discovery process, > * which can throw an <code>IOException</code> when socket > * allocation occurs. > * > * @throws java.rmi.RemoteException typically, this exception occurs when > * there is a communication failure between the client and the > * server. > */ > public void setUnicastPort(int port) throws IOException, RemoteException; > }