查看本类的 API文档回源码主页即时通讯网 - 即时通讯开发者社区!
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.channel;
17  
18  public interface ChannelInboundInvoker {
19  
20      /**
21       * A {@link Channel} was registered to its {@link EventLoop}.
22       *
23       * This will result in having the  {@link ChannelInboundHandler#channelRegistered(ChannelHandlerContext)} method
24       * called of the next  {@link ChannelInboundHandler} contained in the  {@link ChannelPipeline} of the
25       * {@link Channel}.
26       */
27      ChannelInboundInvoker fireChannelRegistered();
28  
29      /**
30       * A {@link Channel} was unregistered from its {@link EventLoop}.
31       *
32       * This will result in having the  {@link ChannelInboundHandler#channelUnregistered(ChannelHandlerContext)} method
33       * called of the next  {@link ChannelInboundHandler} contained in the  {@link ChannelPipeline} of the
34       * {@link Channel}.
35       */
36      ChannelInboundInvoker fireChannelUnregistered();
37  
38      /**
39       * A {@link Channel} is active now, which means it is connected.
40       *
41       * This will result in having the  {@link ChannelInboundHandler#channelActive(ChannelHandlerContext)} method
42       * called of the next  {@link ChannelInboundHandler} contained in the  {@link ChannelPipeline} of the
43       * {@link Channel}.
44       */
45      ChannelInboundInvoker fireChannelActive();
46  
47      /**
48       * A {@link Channel} is inactive now, which means it is closed.
49       *
50       * This will result in having the  {@link ChannelInboundHandler#channelInactive(ChannelHandlerContext)} method
51       * called of the next  {@link ChannelInboundHandler} contained in the  {@link ChannelPipeline} of the
52       * {@link Channel}.
53       */
54      ChannelInboundInvoker fireChannelInactive();
55  
56      /**
57       * A {@link Channel} received an {@link Throwable} in one of its inbound operations.
58       *
59       * This will result in having the  {@link ChannelInboundHandler#exceptionCaught(ChannelHandlerContext, Throwable)}
60       * method  called of the next  {@link ChannelInboundHandler} contained in the  {@link ChannelPipeline} of the
61       * {@link Channel}.
62       */
63      ChannelInboundInvoker fireExceptionCaught(Throwable cause);
64  
65      /**
66       * A {@link Channel} received an user defined event.
67       *
68       * This will result in having the  {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)}
69       * method  called of the next  {@link ChannelInboundHandler} contained in the  {@link ChannelPipeline} of the
70       * {@link Channel}.
71       */
72      ChannelInboundInvoker fireUserEventTriggered(Object event);
73  
74      /**
75       * A {@link Channel} received a message.
76       *
77       * This will result in having the {@link ChannelInboundHandler#channelRead(ChannelHandlerContext, Object)}
78       * method  called of the next {@link ChannelInboundHandler} contained in the  {@link ChannelPipeline} of the
79       * {@link Channel}.
80       */
81      ChannelInboundInvoker fireChannelRead(Object msg);
82  
83      /**
84       * Triggers an {@link ChannelInboundHandler#channelReadComplete(ChannelHandlerContext)}
85       * event to the next {@link ChannelInboundHandler} in the {@link ChannelPipeline}.
86       */
87      ChannelInboundInvoker fireChannelReadComplete();
88  
89      /**
90       * Triggers an {@link ChannelInboundHandler#channelWritabilityChanged(ChannelHandlerContext)}
91       * event to the next {@link ChannelInboundHandler} in the {@link ChannelPipeline}.
92       */
93      ChannelInboundInvoker fireChannelWritabilityChanged();
94  }