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

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

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

Channels.failedFuture介绍

[英]Creates a new ChannelFuture which has failed already for the specified Channel.
[中]为指定的通道创建已失败的新通道Future。

代码示例

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

public ChannelFuture joinGroup(InetAddress multicastAddress) {
  try {
    return joinGroup(
        multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), null);
  } catch (SocketException e) {
    return failedFuture(this, e);
  }
}

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

public ChannelFuture leaveGroup(InetAddress multicastAddress) {
  try {
    return leaveGroup(
        multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), null);
  } catch (SocketException e) {
    return failedFuture(this, e);
  }
}

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

public ChannelFuture joinGroup(InetAddress multicastAddress) {
  ensureBound();
  try {
    socket.joinGroup(multicastAddress);
    return succeededFuture(this);
  } catch (IOException e) {
    return failedFuture(this, e);
  }
}

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

public ChannelFuture joinGroup(
    InetSocketAddress multicastAddress, NetworkInterface networkInterface) {
  ensureBound();
  try {
    socket.joinGroup(multicastAddress, networkInterface);
    return succeededFuture(this);
  } catch (IOException e) {
    return failedFuture(this, e);
  }
}

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

private ChannelFuture writeLastChunk() {
  if (!requestHeaderWritten) {
    return failedFuture(this, new NotYetConnectedException());
  } else {
    return realChannel.write(HttpChunk.LAST_CHUNK);
  }
}

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

public ChannelFuture leaveGroup(InetAddress multicastAddress) {
  try {
    socket.leaveGroup(multicastAddress);
    return succeededFuture(this);
  } catch (IOException e) {
    return failedFuture(this, e);
  }
}

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

public ChannelFuture leaveGroup(
    InetSocketAddress multicastAddress, NetworkInterface networkInterface) {
  try {
    socket.leaveGroup(multicastAddress, networkInterface);
    return succeededFuture(this);
  } catch (IOException e) {
    return failedFuture(this, e);
  }
}

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

/**
 * Block the given sourceToBlock address for the given multicastAddress
 *
 */
public ChannelFuture block(InetAddress multicastAddress, InetAddress sourceToBlock) {
  try {
    block(multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), sourceToBlock);
  } catch (SocketException e) {
    return failedFuture(this, e);
  }
  return succeededFuture(this);
}

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

public ChannelFuture execute(ChannelPipeline pipeline, Runnable task) {
    if (logger.isWarnEnabled()) {
      logger.warn("Not attached yet; rejecting: " + task);
    }
    return Channels.failedFuture(pipeline.getChannel(), new RejectedExecutionException("Not attached yet"));
  }
}

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

/**
   * This implementation just directly call {@link Runnable#run()}.
   * Sub-classes should override this if they can handle it in a better way
   */
  public ChannelFuture execute(ChannelPipeline pipeline, Runnable task) {
    try {
      task.run();
      return succeededFuture(pipeline.getChannel());
    } catch (Throwable t) {
      return failedFuture(pipeline.getChannel(), t);
    }
  }
}

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

return failedFuture(this, e);

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

key.block(sourceToBlock);
} catch (IOException e) {
  return failedFuture(this, e);

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

/**
 * Sends an SSL {@code close_notify} message to the specified channel and
 * destroys the underlying {@link SSLEngine}.
 */
public ChannelFuture close() {
  ChannelHandlerContext ctx = this.ctx;
  Channel channel = ctx.getChannel();
  try {
    engine.closeOutbound();
    return wrapNonAppData(ctx, channel);
  } catch (SSLException e) {
    fireExceptionCaught(ctx, e);
    if (closeOnSslException) {
      Channels.close(ctx, future(channel));
    }
    return failedFuture(channel, e);
  }
}

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

handshakeFuture = this.handshakeFuture = failedFuture(channel, e);
exception = e;

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

future = Channels.failedFuture(
    ctx.getChannel(),
    ZlibUtil.exception(z, "compression failure", resultCode));

代码示例来源:origin: kaazing/gateway

public ChannelFuture joinGroup(InetAddress multicastAddress) {
  try {
    return joinGroup(
        multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), null);
  } catch (SocketException e) {
    return failedFuture(this, e);
  }
}

代码示例来源:origin: kaazing/gateway

public ChannelFuture leaveGroup(InetAddress multicastAddress) {
  try {
    return leaveGroup(
        multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), null);
  } catch (SocketException e) {
    return failedFuture(this, e);
  }
}

代码示例来源:origin: kaazing/gateway

/**
 * Block the given sourceToBlock address for the given multicastAddress
 *
 */
public ChannelFuture block(InetAddress multicastAddress, InetAddress sourceToBlock) {
  try {
    block(multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), sourceToBlock);
  } catch (SocketException e) {
    return failedFuture(this, e);
  }
  return succeededFuture(this);
}

代码示例来源:origin: kaazing/gateway

/**
 * Block the given sourceToBlock address for the given multicastAddress
 *
 */
public ChannelFuture block(InetAddress multicastAddress, InetAddress sourceToBlock) {
  try {
    block(multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), sourceToBlock);
  } catch (SocketException e) {
    return failedFuture(this, e);
  }
  return succeededFuture(this);
}

代码示例来源:origin: projectodd/stilts

public ChannelFuture execute(ChannelPipeline pipeline, Runnable task) {
    try {
      task.run();
      return Channels.succeededFuture(pipeline.getChannel());
    } catch (Throwable t) {
      return Channels.failedFuture(pipeline.getChannel(), t);
    }
  }
}

相关文章