View Javadoc

1   /*
2    * Copyright 2009 Red Hat, Inc.
3    *
4    * Red Hat licenses this file to you under the Apache License, version 2.0
5    * (the "License"); you may not use this file except in compliance with the
6    * 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 org.jboss.netty.channel.socket;
17  
18  import java.net.ServerSocket;
19  
20  import org.jboss.netty.channel.ChannelConfig;
21  
22  /**
23   * A {@link ChannelConfig} for a {@link ServerSocketChannel}.
24   *
25   * <h3>Available options</h3>
26   *
27   * In addition to the options provided by {@link ChannelConfig},
28   * {@link ServerSocketChannelConfig} allows the following options in the
29   * option map:
30   *
31   * <table border="1" cellspacing="0" cellpadding="6">
32   * <tr>
33   * <th>Name</th><th>Associated setter method</th>
34   * </tr><tr>
35   * <td>{@code "backlog"}</td><td>{@link #setBacklog(int)}</td>
36   * </tr><tr>
37   * <td>{@code "reuseAddress"}</td><td>{@link #setReuseAddress(boolean)}</td>
38   * </tr><tr>
39   * <td>{@code "receiveBufferSize"}</td><td>{@link #setReceiveBufferSize(int)}</td>
40   * </tr>
41   * </table>
42   *
43   * @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
44   * @author <a href="http://gleamynode.net/">Trustin Lee</a>
45   *
46   * @version $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
47   */
48  public interface ServerSocketChannelConfig extends ChannelConfig {
49  
50      /**
51       * Gets the backlog value to specify when the channel binds to a local
52       * address.
53       */
54      int getBacklog();
55  
56      /**
57       * Sets the backlog value to specify when the channel binds to a local
58       * address.
59       */
60      void setBacklog(int backlog);
61  
62      /**
63       * Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_REUSEADDR}</a> option.
64       */
65      boolean isReuseAddress();
66  
67      /**
68       * Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_REUSEADDR}</a> option.
69       */
70      void setReuseAddress(boolean reuseAddress);
71  
72      /**
73       * Gets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_RCVBUF}</a> option.
74       */
75      int getReceiveBufferSize();
76  
77      /**
78       * Sets the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/socketOpt.html">{@code SO_RCVBUF}</a> option.
79       */
80      void setReceiveBufferSize(int receiveBufferSize);
81  
82      /**
83       * Sets the performance preferences as specified in
84       * {@link ServerSocket#setPerformancePreferences(int, int, int)}.
85       */
86      void setPerformancePreferences(int connectionTime, int latency, int bandwidth);
87  }