Java Code Examples for io.netty.channel.Channel#toString()

The following examples show how to use io.netty.channel.Channel#toString() . 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: ChannelUtils.java    From zuul with Apache License 2.0 6 votes vote down vote up
public static String channelInfoForLogging(Channel ch)
{
    if (ch == null) {
        return "null";
    }
    
    String channelInfo = ch.toString() 
            + ", active=" + ch.isActive()
            + ", open=" + ch.isOpen()
            + ", registered=" + ch.isRegistered()
            + ", writable=" + ch.isWritable()
            + ", id=" + ch.id();
    
    CurrentPassport passport = CurrentPassport.fromChannel(ch);
    return "Channel: " + channelInfo + ", Passport: " + String.valueOf(passport);
}
 
Example 2
Source File: UdpSenderFactory.java    From easymodbus4j with GNU Lesser General Public License v3.0 5 votes vote down vote up
public UdpSender get(Channel channel) {
	String key = channel.toString();
	if (!channelSendersMap.containsKey(key)) {
		channelSendersMap.put(key, new UdpSender(channel));
	}
	return channelSendersMap.get(key);
}
 
Example 3
Source File: CloseHandler.java    From servicetalk with Apache License 2.0 5 votes vote down vote up
private CloseEventObservedException(@Nullable Throwable cause,
                                    final CloseEvent closeEvent,
                                    final Channel channel) {
    this.event = closeEvent;
    this.channelDetails = channel.toString();
    initCause(cause);
}
 
Example 4
Source File: DownstreamChannelClosedUnexpectedlyException.java    From riposte with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("WeakerAccess")
protected static String getChannelId(Channel channel) {
    if (channel == null)
        return "null";

    return channel.toString();
}
 
Example 5
Source File: DownstreamIdleChannelTimeoutException.java    From riposte with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("WeakerAccess")
protected static String getChannelId(Channel channel) {
    if (channel == null)
        return "null";

    return channel.toString();
}
 
Example 6
Source File: ReactorNetty.java    From reactor-netty with Apache License 2.0 5 votes vote down vote up
/**
 * Append channel ID to a log message for correlated traces
 * @param channel current channel associated with the msg
 * @param msg the log msg
 * @return a formatted msg
 */
public static String format(Channel channel, String msg) {
	if (LOG_CHANNEL_INFO) {
		String channelStr = channel.toString();
		return new StringBuilder(channelStr.length() + 1 + msg.length())
				.append(channel)
				.append(' ')
				.append(msg)
				.toString();
	}
	else {
		return msg;
	}
}
 
Example 7
Source File: ServerConnectionInboundHandler.java    From pravega with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    Channel c = channel.get();
    if (c == null) {
        return "NewServerConnection";
    }
    return c.toString();
}