View Javadoc
1   /*
2    * Copyright 2014 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License, version 2.0 (the
5    * "License"); you may not use this file except in compliance with the License. You may obtain a
6    * copy of the License at:
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software distributed under the License
11   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing permissions and limitations under
13   * the License.
14   */
15  package io.netty.handler.codec.http2;
16  
17  /**
18   * A policy for determining when it is appropriate to remove streams from an HTTP/2 stream registry.
19   */
20  public interface Http2StreamRemovalPolicy {
21  
22      /**
23       * Performs the action of removing the stream.
24       */
25      interface Action {
26          /**
27           * Removes the stream from the registry.
28           */
29          void removeStream(Http2Stream stream);
30      }
31  
32      /**
33       * Sets the removal action.
34       */
35      void setAction(Action action);
36  
37      /**
38       * Marks the given stream for removal. When this policy has determined that the given stream
39       * should be removed, it will call back the {@link Action}.
40       */
41      void markForRemoval(Http2Stream stream);
42  }