in folsom/src/main/java/com/spotify/folsom/ConnectFuture.java [61:81]
private void check(ObservableClient client) {
final Throwable failure = client.getConnectionFailure();
if (failure != null) {
if (completeExceptionally(failure)) {
client.unregisterForConnectionChanges(this);
}
} else if (requireAll) {
final int expectedConnections = awaitConnected ? client.numTotalConnections() : 0;
if (client.numActiveConnections() == expectedConnections) {
if (complete(null)) {
client.unregisterForConnectionChanges(this);
}
}
} else {
if (awaitConnected == client.isConnected()) {
if (complete(null)) {
client.unregisterForConnectionChanges(this);
}
}
}
}