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

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

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

Channel.getPipeline介绍

[英]Returns the ChannelPipeline which handles ChannelEvents associated with this channel.
[中]返回处理与此通道关联的ChannelEvents的ChannelPipeline。

代码示例

代码示例来源:origin: apache/incubator-druid

private void removeHandlers()
 {
  if (readTimeout > 0) {
   channel.getPipeline().remove(READ_TIMEOUT_HANDLER_NAME);
  }
  channel.getPipeline().remove(LAST_HANDLER_NAME);
 }
}

代码示例来源:origin: menacher/java-game-server

public static ChannelPipeline getPipeLineOfConnection(
    NettyTCPMessageSender messageSender)
{
  if(null != messageSender){
    Channel channel = messageSender.getChannel();
    ChannelPipeline pipeline = channel.getPipeline();
    return pipeline;
  }
  return null;
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelInterestChanged"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel} once the io-thread runs again.
 */
public static ChannelFuture fireChannelInterestChangedLater(final Channel channel) {
  return channel.getPipeline().execute(new Runnable() {
    public void run() {
      fireChannelInterestChanged(channel);
    }
  });
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "exceptionCaught"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel} once the io-thread runs again.
 */
public static ChannelFuture fireExceptionCaughtLater(final Channel channel, final Throwable cause) {
  return channel.getPipeline().execute(new Runnable() {
    public void run() {
      fireExceptionCaught(channel, cause);
    }
  });
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "writeComplete"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel} in the next io-thread.
 */
public static ChannelFuture fireWriteCompleteLater(final Channel channel, final long amount) {
  return channel.getPipeline().execute(new Runnable() {
    public void run() {
      fireWriteComplete(channel, amount);
    }
  });
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelUnbound"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel} once the io-thread runs again.
 */
public static ChannelFuture fireChannelUnboundLater(final Channel channel) {
  return channel.getPipeline().execute(new Runnable() {
    public void run() {
      fireChannelUnbound(channel);
    }
  });
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelClosed"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel} once the io-thread runs again.
 */
public static ChannelFuture fireChannelClosedLater(final Channel channel) {
  return channel.getPipeline().execute(new Runnable() {
    public void run() {
      fireChannelClosed(channel);
    }
  });
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelDisconnected"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel} once the io-thread runs again.
 */
public static ChannelFuture fireChannelDisconnectedLater(final Channel channel) {
  return channel.getPipeline().execute(new Runnable() {
    public void run() {
      fireChannelDisconnected(channel);
    }
  });
}
/**

代码示例来源:origin: org.apache.zookeeper/zookeeper

@Override
public void enableRecv() {
  if (throttled) {
    throttled = false;
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sending unthrottle event " + this);
    }
    channel.getPipeline().sendUpstream(new ResumeMessageEvent(channel));
  }
}

代码示例来源:origin: MovingBlocks/Terasology

public ServerImpl(NetworkSystemImpl system, Channel channel) {
  this.channel = channel;
  metricsSource = (NetMetricSource) channel.getPipeline().get(MetricRecordingHandler.NAME);
  this.networkSystem = system;
  this.time = (EngineTime) CoreRegistry.get(Time.class);
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "exceptionCaught"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel}.
 */
public static void fireExceptionCaught(Channel channel, Throwable cause) {
  channel.getPipeline().sendUpstream(
      new DefaultExceptionEvent(channel, cause));
}

代码示例来源:origin: io.netty/netty

private static void fireChildChannelStateChanged(
    Channel channel, Channel childChannel) {
  channel.getPipeline().sendUpstream(
      new DefaultChildChannelStateEvent(channel, childChannel));
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelDisconnected"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel}.
 */
public static void fireChannelDisconnected(Channel channel) {
  channel.getPipeline().sendUpstream(
      new UpstreamChannelStateEvent(
          channel, ChannelState.CONNECTED, null));
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelInterestChanged"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel}.
 */
public static void fireChannelInterestChanged(Channel channel) {
  channel.getPipeline().sendUpstream(
      new UpstreamChannelStateEvent(
          channel, ChannelState.INTEREST_OPS, Channel.OP_READ));
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "writeComplete"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel}.
 */
public static void fireWriteComplete(Channel channel, long amount) {
  if (amount == 0) {
    return;
  }
  channel.getPipeline().sendUpstream(
      new DefaultWriteCompletionEvent(channel, amount));
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelUnbound"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel}.
 */
public static void fireChannelUnbound(Channel channel) {
  channel.getPipeline().sendUpstream(new UpstreamChannelStateEvent(
      channel, ChannelState.BOUND, null));
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelConnected"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel}.
 *
 * @param remoteAddress
 *        the remote address where the specified channel is connected
 */
public static void fireChannelConnected(Channel channel, SocketAddress remoteAddress) {
  channel.getPipeline().sendUpstream(
      new UpstreamChannelStateEvent(
          channel, ChannelState.CONNECTED, remoteAddress));
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "messageReceived"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel} belongs.
 *
 * @param message        the received message
 * @param remoteAddress  the remote address where the received message
 *                       came from
 */
public static void fireMessageReceived(Channel channel, Object message, SocketAddress remoteAddress) {
  channel.getPipeline().sendUpstream(
      new UpstreamMessageEvent(channel, message, remoteAddress));
}

代码示例来源:origin: io.netty/netty

/**
 * Sends a {@code "channelBound"} event to the first
 * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
 * the specified {@link Channel}.
 *
 * @param localAddress
 *        the local address where the specified channel is bound
 */
public static void fireChannelBound(Channel channel, SocketAddress localAddress) {
  channel.getPipeline().sendUpstream(
      new UpstreamChannelStateEvent(
          channel, ChannelState.BOUND, localAddress));
}

代码示例来源:origin: MovingBlocks/Terasology

public Future<ServerInfoMessage> requestInfo(final String address, final int port) {
  return pool.submit(() -> {
    InetSocketAddress remoteAddress = new InetSocketAddress(address, port);
    ChannelFuture connectCheck = bootstrap.connect(remoteAddress);
    connectCheck.syncUninterruptibly();
    Channel channel = connectCheck.getChannel();
    channel.getCloseFuture().syncUninterruptibly();
    ServerInfoRequestHandler handler = channel.getPipeline().get(ServerInfoRequestHandler.class);
    ServerInfoMessage serverInfo = handler.getServerInfo();
    return serverInfo;
  });
}

相关文章