View Javadoc
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    *   http://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.EventLoop;
22  import io.netty.channel.EventLoopGroup;
23  import io.netty.channel.ThreadPerChannelEventLoopGroup;
24  
25  import java.util.concurrent.Executor;
26  import java.util.concurrent.Executors;
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  public class OioEventLoopGroup extends ThreadPerChannelEventLoopGroup {
34  
35      /**
36       * Create a new {@link OioEventLoopGroup} with no limit in place.
37       */
38      public OioEventLoopGroup() {
39          this(0);
40      }
41  
42      /**
43       * Create a new {@link OioEventLoopGroup}.
44       *
45       * @param maxChannels       the maximum number of channels to handle with this instance. Once you try to register
46       *                          a new {@link Channel} and the maximum is exceed it will throw an
47       *                          {@link ChannelException}. Use {@code 0} to use no limit
48       */
49      public OioEventLoopGroup(int maxChannels) {
50          this(maxChannels, Executors.defaultThreadFactory());
51      }
52  
53      /**
54       * Create a new {@link OioEventLoopGroup}.
55       *
56       * @param maxChannels       the maximum number of channels to handle with this instance. Once you try to register
57       *                          a new {@link Channel} and the maximum is exceed it will throw an
58       *                          {@link ChannelException}. Use {@code 0} to use no limit
59       * @param executor     the {@link Executor} used to create new {@link Thread} instances that handle the
60       *                          registered {@link Channel}s
61       */
62      public OioEventLoopGroup(int maxChannels, Executor executor) {
63          super(maxChannels, executor);
64      }
65  
66      /**
67       * Create a new {@link OioEventLoopGroup}.
68       *
69       * @param maxChannels       the maximum number of channels to handle with this instance. Once you try to register
70       *                          a new {@link Channel} and the maximum is exceed it will throw an
71       *                          {@link ChannelException}. Use {@code 0} to use no limit
72       * @param threadFactory     the {@link ThreadFactory} used to create new {@link Thread} instances that handle the
73       *                          registered {@link Channel}s
74       */
75      public OioEventLoopGroup(int maxChannels, ThreadFactory threadFactory) {
76          super(maxChannels, threadFactory);
77      }
78  }