elecharny commented on PR #72:
URL: https://github.com/apache/mina/pull/72#issuecomment-5863501120

   May be using a method like:
   
   ```
   public class AcceptorBindUtil {
       public static final int tryBind(IoAcceptor acceptor) {
           int nbTry = 10;
           
           while (true) {
               int nextAvailable = AvailablePortFinder.getNextAvailable();
               try {
                   acceptor.bind( new InetSocketAddress( nextAvailable ) );
                   
                   return nextAvailable;
               } catch ( IOException e ) {
                   nbTry--;
                   
                   if (nbTry == 0) {
                       throw new RuntimeException(e);
                   }
               }
           }
       }
   }
   ```
   
   which is called this way;
   
   ```
                       int nextAvailable = AcceptorBindUtil.tryBind( acceptor );
   ```
   
   could do the trick (possibly passing the number of tries as a parameter, too)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to