Resolve false probing timeout by delaying the proble a little bit

Change-Id: Ib087f72fa742c614e8b6916a9ea0be4ee08ab064
(cherry picked from commit 17a200e0c12fefe03978c2a595905a7e3bf87171)
This commit is contained in:
Charles Chan 2017-09-13 16:14:22 -07:00 committed by Charles Chan
parent 8e786b5ed9
commit bb86b78a34
2 changed files with 8 additions and 2 deletions

View File

@ -108,7 +108,7 @@ public class DistributedHostStore
private Consumer<Status> statusChangeListener;
// TODO make this configurable
private static final int PROBE_TIMEOUT_MS = 1000;
private static final int PROBE_TIMEOUT_MS = 1500;
private Cache<MacAddress, PendingHostLocation> pendingHostsCache = CacheBuilder.newBuilder()
.expireAfterWrite(PROBE_TIMEOUT_MS, TimeUnit.MILLISECONDS)

View File

@ -90,6 +90,9 @@ import java.util.Dictionary;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import java.util.Set;
@ -447,7 +450,10 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
IPv6.getMCastMacAddress(ip.getIp6Address().toOctets()),
host.id().vlanId());
}
sendProbe(probe, location);
// NOTE: delay the probe a little bit to wait for the store synchronization is done
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
executorService.schedule(() -> sendProbe(probe, location), 1000, TimeUnit.MILLISECONDS);
});
});
}