-
-
Save jeffmaury/a521e79ff4300fc6bd685a36099c1892 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void waitForPortAvailable(int port, IProgressMonitor monitor) throws CoreException{ | |
long start = System.currentTimeMillis(); | |
while (System.currentTimeMillis() - start < 60_000 && !monitor.isCanceled()) { | |
try (Socket socket = new Socket("localhost", port)) { | |
return; | |
} catch (ConnectException e) { | |
try { | |
Thread.sleep(1000L); | |
} catch (InterruptedException e1) { | |
throw new CoreException(new Status(IStatus.ERROR, QuarkusCorePlugin.PLUGIN_ID, e.getLocalizedMessage())); | |
} | |
} catch (IOException e) { | |
throw new CoreException(new Status(IStatus.ERROR, QuarkusCorePlugin.PLUGIN_ID, e.getLocalizedMessage())); | |
} | |
} | |
throw new CoreException(new Status(IStatus.ERROR, QuarkusCorePlugin.PLUGIN_ID, "Can't connect to JVM")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment