Example usage for com.rabbitmq.client.impl.nio SocketChannelFrameHandler getLocalPort

List of usage examples for com.rabbitmq.client.impl.nio SocketChannelFrameHandler getLocalPort

Introduction

In this page you can find the example usage for com.rabbitmq.client.impl.nio SocketChannelFrameHandler getLocalPort.

Prototype

@Override
    public int getLocalPort() 

Source Link

Usage

From source file:com.navercorp.pinpoint.plugin.rabbitmq.client.interceptor.SocketChannelFrameHandlerConstructInterceptor.java

License:Apache License

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (!validate(target)) {
        return;//www .  java  2s.  co  m
    }
    String localAddress = RabbitMQClientConstants.UNKNOWN;
    String remoteAddress = RabbitMQClientConstants.UNKNOWN;
    if (target instanceof SocketChannelFrameHandler) {
        SocketChannelFrameHandler frameHandler = (SocketChannelFrameHandler) target;
        localAddress = HostAndPort.toHostAndPortString(frameHandler.getLocalAddress().getHostAddress(),
                frameHandler.getLocalPort());
        remoteAddress = HostAndPort.toHostAndPortString(frameHandler.getAddress().getHostAddress(),
                frameHandler.getPort());
    }
    ((LocalAddressAccessor) target)._$PINPOINT$_setLocalAddress(localAddress);
    ((RemoteAddressAccessor) target)._$PINPOINT$_setRemoteAddress(remoteAddress);
}