Example usage for java.net InetSocketAddress toString

List of usage examples for java.net InetSocketAddress toString

Introduction

In this page you can find the example usage for java.net InetSocketAddress toString.

Prototype

@Override
public String toString() 

Source Link

Document

Constructs a string representation of this InetSocketAddress.

Usage

From source file:org.apache.hadoop.hbase.ipc.FailedServers.java

/**
 * Add an address to the list of the failed servers list.
 *//*w w  w . j  av a2 s . c  o  m*/
public synchronized void addToFailedServers(InetSocketAddress address, Throwable throwable) {
    final long expiry = EnvironmentEdgeManager.currentTime() + recheckServersTimeout;
    this.failedServers.put(address.toString(), expiry);
    this.latestExpiry = expiry;
    if (LOG.isDebugEnabled()) {
        LOG.debug("Added failed server with address " + address.toString() + " to list caused by "
                + throwable.toString());
    }
}

From source file:com.navercorp.pinpoint.collector.receiver.thrift.udp.UDPReceiverTest.java

@Test
public void hostNullCheck() {
    InetSocketAddress address = new InetSocketAddress((InetAddress) null, PORT);
    logger.debug(address.toString());
}

From source file:cloudfoundry.norouter.f5.client.AbstractIControlClient.java

@Override
public void deletePoolMember(String poolName, InetSocketAddress poolMember) {
    deletePoolMember(poolName, poolMember.toString());
}

From source file:cloudfoundry.norouter.f5.client.AbstractIControlClient.java

@Override
public PoolMember disablePoolMember(String poolName, InetSocketAddress member) {
    final String uri = membersUri(poolName) + "/" + member.toString();
    final JsonNode resource = putResource(uri, DISABLE_POOL_MEMBER_BODY);
    return readValue(resource, PoolMember.class);
}

From source file:cloudfoundry.norouter.f5.client.AbstractIControlClient.java

@Override
public PoolMember addPoolMember(String poolName, InetSocketAddress poolMember, String description) {
    return addPoolMember(poolName, poolMember.toString(), description);
}

From source file:org.apache.ambari.servicemonitor.probes.PortProbe.java

/**
 * Try to connect to the (host,port); a failure to connect within
 * the specified timeout is a failure//ww w .  j  av  a2 s .c  o  m
 * @param livePing is the ping live: true for live; false for boot time
 * @return the outcome
 */
@Override
public ProbeStatus ping(boolean livePing) {
    ProbeStatus status = new ProbeStatus();
    InetSocketAddress sockAddr = new InetSocketAddress(host, port);
    Socket socket = new Socket();
    try {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Connecting to " + sockAddr.toString() + " connection-timeout="
                    + MonitorUtils.millisToHumanTime(timeout));
        }
        socket.connect(sockAddr, timeout);
        status.succeed(this);
    } catch (IOException e) {
        String error = "Probe " + sockAddr + " failed: " + e;
        LOG.debug(error, e);
        status.fail(this, new IOException(error, e));
    } finally {
        IOUtils.closeSocket(socket);
    }
    return status;

}

From source file:cloudfoundry.norouter.f5.client.AbstractIControlClient.java

@Override
public PoolMember updatePoolMemberDescription(String poolName, InetSocketAddress member, String description) {
    final String uri = membersUri(poolName) + "/" + member.toString();
    final JsonNode resource = putResource(uri, Collections.singletonMap("description", description));
    return readValue(resource, PoolMember.class);
}

From source file:org.apache.hadoop.hbase.ipc.FailedServers.java

/**
 * Check if the server should be considered as bad. Clean the old entries of the list.
 *
 * @return true if the server is in the failed servers list
 *//*  w  w  w  .j  a  v a 2 s . c o m*/
public synchronized boolean isFailedServer(final InetSocketAddress address) {
    if (failedServers.isEmpty()) {
        return false;
    }
    final long now = EnvironmentEdgeManager.currentTime();
    if (now > this.latestExpiry) {
        failedServers.clear();
        return false;
    }
    String key = address.toString();
    Long expiry = this.failedServers.get(key);
    if (expiry == null) {
        return false;
    }
    if (expiry >= now) {
        return true;
    } else {
        this.failedServers.remove(key);
    }
    return false;
}

From source file:org.apache.hama.bsp.message.HadoopMessageManagerImpl.java

@Override
public final void transfer(InetSocketAddress addr, BSPMessageBundle<M> bundle) throws IOException {
    HadoopMessageManager<M> bspPeerConnection = this.getBSPPeerConnection(addr);
    if (bspPeerConnection == null) {
        throw new IllegalArgumentException("Can not find " + addr.toString() + " to transfer messages to!");
    } else {/*w w w .j  a v a2  s .  c o  m*/
        if (compressor != null && (bundle.getApproximateSize() > conf
                .getLong("hama.messenger.compression.threshold", 1048576))) {
            BSPCompressedBundle compMsgBundle = compressor.compressBundle(bundle);
            bspPeerConnection.put(compMsgBundle);
            peer.incrementCounter(BSPPeerImpl.PeerCounter.COMPRESSED_MESSAGES, 1L);
        } else {
            bspPeerConnection.put(bundle);
        }
    }
}

From source file:org.apache.hadoop.realtime.ResourceMgrDelegate.java

/**
 * Delegate responsible for communicating with the Resource Manager's
 * {@link ClientRMProtocol}./*  www .  ja v  a2 s  .  c  o  m*/
 * 
 * @param conf
 *          the configuration object.
 */
public ResourceMgrDelegate(YarnConfiguration conf) {
    this.conf = conf;
    YarnRPC rpc = YarnRPC.create(this.conf);
    InetSocketAddress rmAddress = NetUtils.createSocketAddr(
            this.conf.get(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS),
            YarnConfiguration.DEFAULT_RM_PORT, YarnConfiguration.RM_ADDRESS);
    this.rmAddress = rmAddress.toString();
    LOG.debug("Connecting to ResourceManager at " + rmAddress);
    applicationsManager = (ClientRMProtocol) rpc.getProxy(ClientRMProtocol.class, rmAddress, this.conf);
    LOG.debug("Connected to ResourceManager at " + rmAddress);
}