I have tested the issue. With the new code, within approximatively 100 milliseconds, the socket is gone while ant keeps running. PR: 23040 Submitted by: John C. Kendall (jkendall at technologist dot com) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275217 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -236,6 +236,9 @@ Fixed bugs: | |||||
| * Project.toBoolean(String) now handles null as argument and does not throw a | * Project.toBoolean(String) now handles null as argument and does not throw a | ||||
| NullPointerException any more. | NullPointerException any more. | ||||
| * The socket condition will now close the socket created to test. | |||||
| Bugzilla Report 23040. | |||||
| Other changes: | Other changes: | ||||
| -------------- | -------------- | ||||
| * All tasks can be used outside of <target>s. Note that some tasks | * All tasks can be used outside of <target>s. Note that some tasks | ||||
| @@ -103,11 +103,22 @@ public class Socket extends ProjectComponent implements Condition { | |||||
| } | } | ||||
| log("Checking for listener at " + server + ":" + port, | log("Checking for listener at " + server + ":" + port, | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| java.net.Socket s = null; | |||||
| try { | try { | ||||
| new java.net.Socket(server, port); | |||||
| s = new java.net.Socket(server, port); | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| finally { | |||||
| if (s != null){ | |||||
| try { | |||||
| s.close(); | |||||
| } | |||||
| catch (IOException ioe){ | |||||
| // Intentionally left blank | |||||
| } | |||||
| } | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||