Example usage for io.vertx.core.net.impl SocketAddressImpl SocketAddressImpl

List of usage examples for io.vertx.core.net.impl SocketAddressImpl SocketAddressImpl

Introduction

In this page you can find the example usage for io.vertx.core.net.impl SocketAddressImpl SocketAddressImpl.

Prototype

public SocketAddressImpl(int port, String host) 

Source Link

Usage

From source file:org.apache.servicecomb.foundation.vertx.metrics.DefaultHttpClientMetrics.java

License:Apache License

@Override
public DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize) {
    SocketAddress address = new SocketAddressImpl(port, host);
    return clientEndpointMetricManager.getOrCreateClientEndpointMetric(address);
}

From source file:org.apache.servicecomb.foundation.vertx.metrics.DefaultHttpClientMetrics.java

License:Apache License

@Override
public DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName) {
    // when host of createEndpoint is not ip but a hostName
    // get from remoteAddress will return null
    // in this time need to try again with remoteName
    // connected is a low frequency method, this try logic will not cause performance problem

    DefaultClientEndpointMetric clientEndpointMetric = this.clientEndpointMetricManager
            .getClientEndpointMetric(remoteAddress);
    if (clientEndpointMetric == null) {
        SocketAddressImpl address = new SocketAddressImpl(remoteAddress.port(), remoteName);
        clientEndpointMetric = this.clientEndpointMetricManager.getClientEndpointMetric(address);
    }/*ww  w.  j a  v  a  2 s . c o m*/
    // it's better to be done in endpointConnected
    // but there is bug before vertx 3.6.0 vertx not invoke endpointConnected for http2
    // to avoid this bug, we move the logic here
    clientEndpointMetric.onConnect();
    return new DefaultHttpSocketMetric(clientEndpointMetric);
}