mirror of https://github.com/apache/activemq.git
Clean up connection resources on failed connect.
This commit is contained in:
parent
ef97b67f00
commit
8a34ca0ec7
|
@ -165,6 +165,7 @@ public class AmqpConnection extends AmqpAbstractResource<Connection> implements
|
|||
}
|
||||
});
|
||||
|
||||
try {
|
||||
if (connectTimeout <= 0) {
|
||||
future.sync();
|
||||
} else {
|
||||
|
@ -173,6 +174,13 @@ public class AmqpConnection extends AmqpAbstractResource<Connection> implements
|
|||
throw new IOException("Failed to connect after configured timeout.");
|
||||
}
|
||||
}
|
||||
} catch (Throwable error) {
|
||||
try {
|
||||
close();
|
||||
} catch (Throwable ignore) {}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue