Example usage for io.netty.handler.codec.http2 Http2Stream removeProperty

List of usage examples for io.netty.handler.codec.http2 Http2Stream removeProperty

Introduction

In this page you can find the example usage for io.netty.handler.codec.http2 Http2Stream removeProperty.

Prototype

<V> V removeProperty(Http2Connection.PropertyKey key);

Source Link

Document

Returns and removes application-defined data if any was associated with this stream.

Usage

From source file:com.linkedin.r2.transport.http.client.Http2StreamCodec.java

License:Apache License

private void doHandleStreamException(Http2Stream stream, ChannelHandlerContext ctx, Throwable cause) {
    Http2Connection.PropertyKey callbackKey = ctx.channel()
            .attr(Http2ClientPipelineInitializer.CALLBACK_ATTR_KEY).get();
    Http2Connection.PropertyKey handleKey = ctx.channel()
            .attr(Http2ClientPipelineInitializer.CHANNEL_POOL_HANDLE_ATTR_KEY).get();

    // Invokes the call back with error
    TimeoutTransportCallback<StreamResponse> callback = stream.removeProperty(callbackKey);
    if (callback != null) {
        callback.onResponse(/*from w  ww . j  av  a2  s.c  om*/
                TransportResponseImpl.<StreamResponse>error(cause, Collections.<String, String>emptyMap()));
    }

    // Signals to dispose the channel back to the pool
    TimeoutAsyncPoolHandle<Channel> handle = stream.removeProperty(handleKey);
    if (handle != null) {
        ctx.fireChannelRead(handle.error());
    }
}

From source file:com.turo.pushy.apns.ApnsClientHandler.java

License:Open Source License

void retryPushNotificationFromStream(final ChannelHandlerContext context, final int streamId) {
    final Http2Stream stream = this.connection().stream(streamId);

    final PushNotificationPromise responsePromise = stream.removeProperty(this.responsePromisePropertyKey);

    final ChannelPromise writePromise = context.channel().newPromise();
    this.writePushNotification(context, responsePromise, writePromise);
}

From source file:com.turo.pushy.apns.ApnsClientHandler.java

License:Open Source License

@Override
public void onStreamRemoved(final Http2Stream stream) {
    stream.removeProperty(this.responseHeadersPropertyKey);
    stream.removeProperty(this.responsePromisePropertyKey);
}