查看本类的 API文档回源码主页即时通讯网 - 即时通讯开发者社区!
1   /*
2    * Copyright 2012 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.oio;
17  
18  
19  import io.netty.channel.Channel;
20  import io.netty.channel.ChannelException;
21  import io.netty.channel.ChannelPromise;
22  import io.netty.channel.EventLoop;
23  import io.netty.channel.EventLoopGroup;
24  import io.netty.channel.ThreadPerChannelEventLoopGroup;
25  
26  import java.util.concurrent.Executor;
27  import java.util.concurrent.ThreadFactory;
28  
29  /**
30   * {@link EventLoopGroup} which is used to handle OIO {@link Channel}'s. Each {@link Channel} will be handled by its
31   * own {@link EventLoop} to not block others.
32   *
33   * @deprecated use NIO / EPOLL / KQUEUE transport.
34   */
35  @Deprecated
36  public class OioEventLoopGroup extends ThreadPerChannelEventLoopGroup {
37  
38      /**
39       * Create a new {@link OioEventLoopGroup} with no limit in place.
40       */
41      public OioEventLoopGroup() {
42          this(0);
43      }
44  
45      /**
46       * Create a new {@link OioEventLoopGroup}.
47       *
48       * @param maxChannels       the maximum number of channels to handle with this instance. Once you try to register
49       *                          a new {@link Channel} and the maximum is exceed it will throw an
50       *                          {@link ChannelException} on the {@link #register(Channel)} and
51       *                          {@link #register(ChannelPromise)} method.
52       *                          Use {@code 0} to use no limit
53       */
54      public OioEventLoopGroup(int maxChannels) {
55          this(maxChannels, (ThreadFactory) null);
56      }
57  
58      /**
59       * Create a new {@link OioEventLoopGroup}.
60       *
61       * @param maxChannels       the maximum number of channels to handle with this instance. Once you try to register
62       *                          a new {@link Channel} and the maximum is exceed it will throw an
63       *                          {@link ChannelException} on the {@link #register(Channel)} and
64       *                          {@link #register(ChannelPromise)} method.
65       *                          Use {@code 0} to use no limit
66       * @param executor     the {@link Executor} used to create new {@link Thread} instances that handle the
67       *                          registered {@link Channel}s
68       */
69      public OioEventLoopGroup(int maxChannels, Executor executor) {
70          super(maxChannels, executor);
71      }
72  
73      /**
74       * Create a new {@link OioEventLoopGroup}.
75       *
76       * @param maxChannels       the maximum number of channels to handle with this instance. Once you try to register
77       *                          a new {@link Channel} and the maximum is exceed it will throw an
78       *                          {@link ChannelException} on the {@link #register(Channel)} and
79       *                          {@link #register(ChannelPromise)} method.
80       *                          Use {@code 0} to use no limit
81       * @param threadFactory     the {@link ThreadFactory} used to create new {@link Thread} instances that handle the
82       *                          registered {@link Channel}s
83       */
84      public OioEventLoopGroup(int maxChannels, ThreadFactory threadFactory) {
85          super(maxChannels, threadFactory);
86      }
87  }