View Javadoc
1   /*
2    * Copyright 2016 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.handler.codec.http2;
17  
18  import io.netty.buffer.ByteBuf;
19  import io.netty.buffer.ByteBufHolder;
20  
21  /**
22   * HTTP/2 GOAWAY frame.
23   *
24   * <p>The last stream identifier <em>must not</em> be set by the application, but instead the
25   * relative {@link #extraStreamIds()} should be used. The {@link #lastStreamId()} will only be
26   * set for incoming GOAWAY frames by the HTTP/2 codec.
27   *
28   * <p>Graceful shutdown as described in the HTTP/2 spec can be accomplished by calling
29   * {@code #setExtraStreamIds(Integer.MAX_VALUE)}.
30   */
31  public interface Http2GoAwayFrame extends Http2Frame, ByteBufHolder {
32      /**
33       * The reason for beginning closure of the connection. Represented as an HTTP/2 error code.
34       */
35      long errorCode();
36  
37      /**
38       * The number of IDs to reserve for the receiver to use while GOAWAY is in transit. This allows
39       * for new streams currently en route to still be created, up to a point, which allows for very
40       * graceful shutdown of both sides.
41       */
42      int extraStreamIds();
43  
44      /**
45       * Sets the number of IDs to reserve for the receiver to use while GOAWAY is in transit.
46       *
47       * @see #extraStreamIds
48       * @return {@code this}
49       */
50      Http2GoAwayFrame setExtraStreamIds(int extraStreamIds);
51  
52      /**
53       * Returns the last stream identifier if set, or {@code -1} else.
54       */
55      int lastStreamId();
56  
57      /**
58       * Optional debugging information describing cause the GOAWAY. Will not be {@code null}, but may
59       * be empty.
60       */
61      @Override
62      ByteBuf content();
63  
64      @Override
65      Http2GoAwayFrame copy();
66  
67      @Override
68      Http2GoAwayFrame duplicate();
69  
70      @Override
71      Http2GoAwayFrame retainedDuplicate();
72  
73      @Override
74      Http2GoAwayFrame replace(ByteBuf content);
75  
76      @Override
77      Http2GoAwayFrame retain();
78  
79      @Override
80      Http2GoAwayFrame retain(int increment);
81  
82      @Override
83      Http2GoAwayFrame touch();
84  
85      @Override
86      Http2GoAwayFrame touch(Object hint);
87  }