Java Code Examples for org.apache.ratis.protocol.RaftPeer#getAddress()

The following examples show how to use org.apache.ratis.protocol.RaftPeer#getAddress() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MiniRaftCluster.java    From incubator-ratis with Apache License 2.0 5 votes vote down vote up
protected int getPort(RaftPeerId id, RaftGroup g) {
  final RaftPeer p = g != null? g.getPeer(id): peers.get(id);
  final String address = p == null? null : p.getAddress();
  final InetSocketAddress inetAddress = address != null?
      NetUtils.createSocketAddr(address): NetUtils.createLocalServerAddress();
  return inetAddress.getPort();
}
 
Example 2
Source File: MiniRaftCluster.java    From ratis with Apache License 2.0 5 votes vote down vote up
protected int getPort(RaftPeerId id, RaftGroup g) {
  final RaftPeer p = g != null? g.getPeer(id): peers.get(id);
  final String address = p == null? null : p.getAddress();
  final InetSocketAddress inetAddress = address != null?
      NetUtils.createSocketAddr(address): NetUtils.createLocalServerAddress();
  return inetAddress.getPort();
}