Tabnine Logo
Channels.setAttribute
Code IndexAdd Tabnine to your IDE (free)

How to use
setAttribute
method
in
com.ning.http.client.providers.netty.channel.Channels

Best Java code snippets using com.ning.http.client.providers.netty.channel.Channels.setAttribute (Showing top 12 results out of 315)

origin: com.ning/async-http-client

public static void setDiscard(Channel channel) {
  setAttribute(channel, DiscardEvent.INSTANCE);
}
origin: com.ning/async-http-client

public void drainChannelAndOffer(final Channel channel, final NettyResponseFuture<?> future, boolean keepAlive, Object partitionKey) {
  Channels.setAttribute(channel, newDrainCallback(future, channel, keepAlive, partitionKey));
}

origin: com.ning/async-http-client

Channels.setAttribute(channel, future);
origin: com.ning/async-http-client

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
  if (requestSender.isClosed())
    return;
  Channel channel = ctx.getChannel();
  channelManager.removeAll(channel);
  try {
    super.channelClosed(ctx, e);
  } catch (Exception ex) {
    LOGGER.trace("super.channelClosed", ex);
  }
  Object attribute = Channels.getAttribute(channel);
  LOGGER.debug("Channel Closed: {} with attribute {}", channel, attribute);
  if (attribute instanceof Callback) {
    Callback callback = (Callback) attribute;
    Channels.setAttribute(channel, callback.future());
    callback.call();
  } else if (attribute instanceof NettyResponseFuture<?>) {
    NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute;
    future.touch();
    if (!config.getIOExceptionFilters().isEmpty()
        && requestSender.applyIoExceptionFiltersAndReplayRequest(future, CHANNEL_CLOSED_EXCEPTION, channel))
      return;
    protocol.onClose(future);
    requestSender.handleUnexpectedClosedChannel(channel, future);
  }
}
origin: com.ning/async-http-client

private void writeRequest(Channel channel) {
  LOGGER.debug("Using non-cached Channel {} for {} '{}'",
      channel,
      future.getNettyRequest().getHttpRequest().getMethod(),
      future.getNettyRequest().getHttpRequest().getUri());
  Channels.setAttribute(channel, future);
  if (future.isDone()) {
    abortChannelPreemption();
    return;
  }
  if (future.getAsyncHandler() instanceof AsyncHandlerExtensions)
    AsyncHandlerExtensions.class.cast(future.getAsyncHandler()).onConnectionOpen();
  channelManager.registerOpenChannel(channel, partitionKey);
  future.attachChannel(channel, false);
  requestSender.writeRequest(future, channel);
}
origin: io.gatling/async-http-client

public static void setDiscard(Channel channel) {
  setAttribute(channel, DiscardEvent.INSTANCE);
}
origin: io.gatling/async-http-client

private <T> ListenableFuture<T> sendRequestWithCachedChannel(Request request, UriComponents uri, ProxyServer proxy,
    NettyResponseFuture<T> future, AsyncHandler<T> asyncHandler, Channel channel) throws IOException {
  future.setState(NettyResponseFuture.STATE.POOLED);
  future.attachChannel(channel, false);
  LOGGER.debug("\nUsing cached Channel {}\n for request \n{}\n", channel, future.getNettyRequest().getHttpRequest());
  Channels.setAttribute(channel, future);
  try {
    writeRequest(future, channel);
  } catch (Exception ex) {
    LOGGER.debug("writeRequest failure", ex);
    if (ex.getMessage() != null && ex.getMessage().contains("SSLEngine")) {
      LOGGER.debug("SSLEngine failure", ex);
      future = null;
    } else {
      try {
        asyncHandler.onThrowable(ex);
      } catch (Throwable t) {
        LOGGER.warn("doConnect.writeRequest()", t);
      }
      IOException ioe = new IOException(ex.getMessage());
      ioe.initCause(ex);
      throw ioe;
    }
  }
  return future;
}
origin: io.gatling/async-http-client

  public void drainChannel(final Channel channel, final NettyResponseFuture<?> future) {
    Channels.setAttribute(channel, newDrainCallback(future, channel, future.isKeepAlive(), getPoolKey(future)));
  }
}
origin: io.gatling/async-http-client

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
  if (requestSender.isClosed())
    return;
  Channel channel = ctx.getChannel();
  channelManager.removeAll(channel);
  try {
    super.channelClosed(ctx, e);
  } catch (Exception ex) {
    LOGGER.trace("super.channelClosed", ex);
  }
  Object attribute = Channels.getAttribute(channel);
  LOGGER.debug("Channel Closed: {} with attribute {}", channel, attribute);
  if (attribute instanceof Callback) {
    Callback callback = (Callback) attribute;
    Channels.setAttribute(channel, callback.future());
    callback.call();
  } else if (attribute instanceof NettyResponseFuture<?>) {
    NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute;
    future.touch();
    if (!config.getIOExceptionFilters().isEmpty()
        && requestSender.applyIoExceptionFiltersAndReplayRequest(future, CHANNEL_CLOSED_EXCEPTION, channel))
      return;
    protocol.onClose(channel);
    if (future == null || future.isDone())
      channelManager.closeChannel(channel);
    else if (!requestSender.retry(future, ctx.getChannel()))
      requestSender.abort(future, REMOTELY_CLOSED_EXCEPTION);
  }
}
origin: io.gatling/async-http-client

public final void operationComplete(ChannelFuture f) throws Exception {
  Channel channel = f.getChannel();
  if (f.isSuccess()) {
    Channels.setAttribute(channel, future);
    final SslHandler sslHandler = ChannelManager.getSslHandler(channel.getPipeline());
origin: io.gatling/async-http-client

  Channels.setAttribute(channel, callback);
else
  callback.call();
origin: io.gatling/async-http-client

  Channels.setAttribute(channel, callback);
} else {
com.ning.http.client.providers.netty.channelChannelssetAttribute

Popular methods of Channels

  • getAttribute
  • isChannelValid
  • setDiscard
  • silentlyCloseChannel

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • getContentResolver (Context)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JPanel (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now