Skip to content

Commit

Permalink
issue # 49 Rename and possibly move static method for determining loc…
Browse files Browse the repository at this point in the history
…al ephemeral address (opensearch-project#85)

* issue opensearch-project#28

Signed-off-by: mloufra <[email protected]>

* Update the lastest coomit

Signed-off-by: mloufra <[email protected]>

* Rename the method getLocalEphemeral to createLocalEphemeralAddress

Signed-off-by: mloufra <[email protected]>

* Change access modifier

Signed-off-by: mloufra <[email protected]>

Signed-off-by: mloufra <[email protected]>
  • Loading branch information
mloufra authored and kokibas committed Mar 17, 2023
1 parent bc98800 commit 3a6950c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/opensearch/sdk/ActionListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ActionListener {
* @throws UnknownHostException if the local host name could not be resolved into an address.
*/
@SuppressForbidden(reason = "need local ephemeral port")
protected static InetSocketAddress getLocalEphemeral() throws UnknownHostException {
private static InetSocketAddress createLocalEphemeralAddress() throws UnknownHostException {
return new InetSocketAddress(InetAddress.getLocalHost(), 0);
}

Expand All @@ -50,7 +50,7 @@ public void runActionListener(boolean flag, int timeout) {
// for testing considerations, otherwise zero which is interpreted as an infinite timeout
socket.setSoTimeout(timeout);

socket.bind(getLocalEphemeral(), 1);
socket.bind(createLocalEphemeralAddress(), 1);
socket.setReuseAddress(true);

Thread t = new Thread() {
Expand Down

0 comments on commit 3a6950c

Please sign in to comment.