public String getClientAddress() { if (null != peer.cnxnFactory) { return formatInetAddr(peer.cnxnFactory.getLocalAddress()); } else { return ""; } }
public String getQuorumAddress() { return formatInetAddr(peer.getQuorumAddress()); }
public String getElectionAddress() { return formatInetAddr(peer.getElectionAddress()); }
/** * Only used by QuorumStats at the moment */ public String[] getQuorumPeers() { List<String> l = new ArrayList<String>(); synchronized (this) { if (leader != null) { for (LearnerHandler fh : leader.getLearners()) { if (fh.getSocket() != null) { String s = formatInetAddr((InetSocketAddress)fh.getSocket().getRemoteSocketAddress()); if (leader.isLearnerSynced(fh)) s += "*"; l.add(s); } } } else if (follower != null) { l.add(formatInetAddr((InetSocketAddress)follower.sock.getRemoteSocketAddress())); } } return l.toArray(new String[0]); }
private void updateThreadName() { String plain = cnxnFactory != null ? cnxnFactory.getLocalAddress() != null ? formatInetAddr(cnxnFactory.getLocalAddress()) : "disabled" : "disabled"; String secure = secureCnxnFactory != null ? formatInetAddr(secureCnxnFactory.getLocalAddress()) : "disabled"; setName(String.format("QuorumPeer[myid=%d](plain=%s)(secure=%s)", getId(), plain, secure)); }
@Test public void testFormatInetAddrGoodIpv4() { InetSocketAddress isa = new InetSocketAddress(v4addr, port); Assert.assertEquals("127.0.0.1:1234", NetUtils.formatInetAddr(isa)); }
@Test public void testFormatAddrUnresolved() { InetSocketAddress isa = InetSocketAddress.createUnresolved("doesnt.exist.com", 1234); Assert.assertEquals("doesnt.exist.com:1234", NetUtils.formatInetAddr(isa)); } }
@Test public void testFormatInetAddrGoodIpv6Ext() { // Have to use the expanded address here, hence not using v6addr in instantiation InetSocketAddress isa = new InetSocketAddress("2600::", port); Assert.assertEquals(v6ext, NetUtils.formatInetAddr(isa)); }
this.clientPortAddress = new InetSocketAddress( InetAddress.getByName(clientPortAddress), clientPort); LOG.info("clientPortAddress is {}", formatInetAddr(this.clientPortAddress)); } else { this.clientPortAddress = new InetSocketAddress(clientPort); LOG.info("clientPortAddress is {}", formatInetAddr(this.clientPortAddress)); this.secureClientPortAddress = new InetSocketAddress( InetAddress.getByName(secureClientPortAddress), secureClientPort); LOG.info("secureClientPortAddress is {}", formatInetAddr(this.secureClientPortAddress)); } else { this.secureClientPortAddress = new InetSocketAddress(secureClientPort); LOG.info("secureClientPortAddress is {}", formatInetAddr(this.secureClientPortAddress));
@Test public void testFormatInetAddrGoodIpv6Local() { // Have to use the expanded address here, hence not using v6addr in instantiation InetSocketAddress isa = new InetSocketAddress("::1", port); Assert.assertEquals(v6local, NetUtils.formatInetAddr(isa)); }
String addr = formatInetAddr(self.getElectionAddress()); byte[] addr_bytes = addr.getBytes(); dout.writeInt(addr_bytes.length);
@Test public void testFormatInetAddrGoodHostname() { InetSocketAddress isa = new InetSocketAddress("localhost", 1234); Assert.assertThat(NetUtils.formatInetAddr(isa), AnyOf.anyOf(IsEqual.equalTo(v4local), IsEqual.equalTo(v6local) )); }
setSockOpts(client); LOG.info("Received connection request " + formatInetAddr((InetSocketAddress)client.getRemoteSocketAddress())); + "I won't be able to participate in leader " + "election any longer: " + formatInetAddr(self.getElectionAddress())); if (exitException instanceof BindException) {