When the strategy determines that a connection attempt should not be
made it will throw an exception. Peel this case out of the rest of
connection handling and add a dedicated message.
Change-Id: I9dd897f487421ba096240ebc9e3d999a7a5d7489
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
@SuppressWarnings("checkstyle:illegalCatch")
synchronized void connect() {
@SuppressWarnings("checkstyle:illegalCatch")
synchronized void connect() {
- final int timeout = strategy.getConnectTimeout();
+ timeout = strategy.getConnectTimeout();
+ } catch (Exception e) {
+ LOG.info("Connection to {} aborted due to strategy decision", address, e);
+ setFailure(e);
+ return;
+ }
- LOG.debug("Promise {} attempting connect for {}ms", this, timeout);
+ LOG.debug("Promise {} attempting connect for {}ms", this, timeout);
if (address.isUnresolved()) {
address = new InetSocketAddress(address.getHostName(), address.getPort());
}
if (address.isUnresolved()) {
address = new InetSocketAddress(address.getHostName(), address.getPort());
}