From 3fa7a7ebfeb68ee966c7ed8966bcadc199e29c7b Mon Sep 17 00:00:00 2001 From: Charles Allen Date: Thu, 25 Feb 2016 08:09:08 -0800 Subject: [PATCH] Limit PortFinder to 0xFFFF --- .../src/main/java/io/druid/indexing/overlord/PortFinder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/PortFinder.java b/indexing-service/src/main/java/io/druid/indexing/overlord/PortFinder.java index 012756ebe7d..f10a0366f08 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/PortFinder.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/PortFinder.java @@ -95,7 +95,8 @@ public class PortFinder private int chooseNext(int start) { - for (int i = start; i < Integer.MAX_VALUE; i++) { + // up to unsigned short max (65535) + for (int i = start; i <= 0xFFFF; i++) { if (!usedPorts.contains(i)) { return i; }