org.jboss.netty.channel.Channel.getAttachment()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.jboss.netty.channel.Channel.getAttachment()方法的一些代码示例,展示了Channel.getAttachment()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.getAttachment()方法的具体详情如下:
包路径:org.jboss.netty.channel.Channel
类名称:Channel
方法名:getAttachment

Channel.getAttachment介绍

[英]Retrieves an object which is #setAttachment(Object) to this Channel.
[中]检索此通道的#setAttachment(对象)对象。

代码示例

代码示例来源:origin: com.ning/async-http-client

public static Object getAttribute(Channel channel) {
  return channel.getAttachment();
}

代码示例来源:origin: org.apache.camel/camel-netty

/**
 * To get the {@link NettyCamelState} from the given channel.
 */
public NettyCamelState getState(Channel channel) {
  return (NettyCamelState) channel.getAttachment();
}

代码示例来源:origin: org.asynchttpclient/async-http-client-netty3-provider

public static Object getAttribute(Channel channel) {
  return channel.getAttachment();
}

代码示例来源:origin: io.gatling/async-http-client

public static Object getAttribute(Channel channel) {
  return channel.getAttachment();
}

代码示例来源:origin: org.asynchttpclient/async-http-client-netty3

public static Object getAttribute(Channel channel) {
  return channel.getAttachment();
}

代码示例来源:origin: io.libraft/libraft-agent

@Override
  public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
    Object attachment = e.getChannel().getAttachment();
    Throwable channelException = e.getCause();

    if (channelException instanceof ConnectException) {
      LOGGER.warn("{}: closing channel to {}: {}", self, attachment, channelException.getMessage());
    } else {
      LOGGER.warn("{}: caught exception - closing channel to {}", self, attachment, channelException);
    }

    e.getChannel().close();
  }
}

代码示例来源:origin: k3po/k3po

ChannelAddress transportCandidate = (ChannelAddress) ctx.getChannel().getParent().getAttachment();
ChannelAddress candidate = new ChannelAddress(tlsLocation, transportCandidate);

代码示例来源:origin: k3po/k3po

ChannelAddress transportCandidate = (ChannelAddress) ctx.getChannel().getParent().getAttachment();
ChannelAddress candidate = new ChannelAddress(httpLocation, transportCandidate);

相关文章