no jira - fix leak of connection in case of failed attempt to connect
This commit is contained in:
parent
fa439375e9
commit
824eaf7a69
|
@ -135,8 +135,7 @@ public class ServerUtil {
|
|||
public static boolean waitForServerToStart(String uri, String username, String password, long timeout) throws InterruptedException {
|
||||
long realTimeout = System.currentTimeMillis() + timeout;
|
||||
while (System.currentTimeMillis() < realTimeout) {
|
||||
try (ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory(uri, null)) {
|
||||
cf.createConnection(username, password).close();
|
||||
try (ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory(uri, null); Connection c = cf.createConnection(username, password)) {
|
||||
System.out.println("server " + uri + " started");
|
||||
} catch (Exception e) {
|
||||
System.out.println("awaiting server " + uri + " start at ");
|
||||
|
|
Loading…
Reference in New Issue