Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-449 Enable getting slave addresses via properties
- Loading branch information
Showing
9 changed files
with
142 additions
and
12 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
45 changes: 45 additions & 0 deletions
45
core/src/main/java/org/radargun/utils/SlaveConnectionInfo.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.radargun.utils; | ||
|
||
import java.io.Serializable; | ||
import java.net.InetAddress; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Holds the list of network interfaces and their IP addresses for a single slave. | ||
*/ | ||
public class SlaveConnectionInfo implements Serializable { | ||
private int slaveIndex; | ||
private Map<String, ArrayList<InetAddress>> interfaceToAddrs = new HashMap<>(); | ||
|
||
public void addAddresses(int slaveIndex, String interfaceName, ArrayList<InetAddress> addresses) { | ||
this.slaveIndex = slaveIndex; | ||
interfaceToAddrs.put(interfaceName, addresses); | ||
} | ||
|
||
public List<InetAddress> getAddresses(String interfaceName) { | ||
return interfaceToAddrs.get(interfaceName); | ||
} | ||
|
||
public String getAddressesAsString(String interfaceName, String delimiter) { | ||
return String.join(delimiter, interfaceToAddrs.get(interfaceName).stream().map(addr -> addr.getHostAddress()).collect(Collectors.toList())); | ||
} | ||
|
||
public Set<String> getInterfaceNames() { | ||
return interfaceToAddrs.keySet(); | ||
} | ||
|
||
public int getSlaveIndex() { | ||
return slaveIndex; | ||
} | ||
|
||
/** | ||
* Used as a message ID for master-slave communication. | ||
*/ | ||
public static class Request implements Serializable { | ||
} | ||
} |
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