2008-08-08 02:37:18 +02:00
|
|
|
/*
|
2011-12-09 06:18:34 +01:00
|
|
|
* Copyright 2011 The Netty Project
|
2008-08-08 02:37:18 +02:00
|
|
|
*
|
2011-12-09 06:18:34 +01:00
|
|
|
* The Netty Project licenses this file to you under the Apache License,
|
|
|
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at:
|
2008-08-08 02:37:18 +02:00
|
|
|
*
|
2011-12-09 06:18:34 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2008-08-08 03:27:24 +02:00
|
|
|
*
|
2009-08-28 09:15:49 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
2011-12-09 06:18:34 +01:00
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
2009-08-28 09:15:49 +02:00
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2008-08-08 02:37:18 +02:00
|
|
|
*/
|
2011-12-09 04:38:59 +01:00
|
|
|
package io.netty.channel;
|
2008-08-08 02:37:18 +02:00
|
|
|
|
2011-12-09 04:38:59 +01:00
|
|
|
import io.netty.channel.socket.SocketChannelConfig;
|
|
|
|
import io.netty.channel.socket.nio.NioSocketChannelConfig;
|
2008-09-02 14:04:04 +02:00
|
|
|
|
2012-05-01 10:53:38 +02:00
|
|
|
import java.util.Map;
|
|
|
|
|
2008-08-08 02:37:18 +02:00
|
|
|
/**
|
2008-09-02 15:45:14 +02:00
|
|
|
* A set of configuration properties of a {@link Channel}.
|
2008-09-02 09:13:20 +02:00
|
|
|
* <p>
|
2008-09-03 03:30:17 +02:00
|
|
|
* Please down-cast to more specific configuration type such as
|
|
|
|
* {@link SocketChannelConfig} or use {@link #setOptions(Map)} to set the
|
2008-09-02 15:45:14 +02:00
|
|
|
* transport-specific properties:
|
|
|
|
* <pre>
|
2010-02-02 03:00:04 +01:00
|
|
|
* {@link Channel} ch = ...;
|
|
|
|
* {@link SocketChannelConfig} cfg = <strong>({@link SocketChannelConfig}) ch.getConfig();</strong>
|
2008-09-03 03:30:17 +02:00
|
|
|
* cfg.setTcpNoDelay(false);
|
2008-09-02 15:45:14 +02:00
|
|
|
* </pre>
|
2008-08-08 02:37:18 +02:00
|
|
|
*
|
2008-09-24 13:28:46 +02:00
|
|
|
* <h3>Option map</h3>
|
|
|
|
*
|
|
|
|
* An option map property is a dynamic write-only property which allows
|
|
|
|
* the configuration of a {@link Channel} without down-casting its associated
|
|
|
|
* {@link ChannelConfig}. To update an option map, please call {@link #setOptions(Map)}.
|
|
|
|
* <p>
|
2012-05-01 11:17:12 +02:00
|
|
|
* Options are available in the sub-types of {@link ChannelConfig}. For
|
2008-09-24 13:28:46 +02:00
|
|
|
* example, you can configure the parameters which are specific to a TCP/IP
|
|
|
|
* socket as explained in {@link SocketChannelConfig} or {@link NioSocketChannelConfig}.
|
2012-05-01 11:17:12 +02:00
|
|
|
*
|
2011-12-09 04:38:59 +01:00
|
|
|
* @apiviz.has io.netty.channel.ChannelPipelineFactory
|
|
|
|
* @apiviz.composedOf io.netty.channel.ReceiveBufferSizePredictor
|
2009-04-28 14:11:01 +02:00
|
|
|
*
|
|
|
|
* @apiviz.excludeSubtypes
|
2008-08-08 02:37:18 +02:00
|
|
|
*/
|
|
|
|
public interface ChannelConfig {
|
2008-09-02 09:13:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the configuration properties from the specified {@link Map}.
|
|
|
|
*/
|
2008-08-08 02:37:18 +02:00
|
|
|
void setOptions(Map<String, Object> options);
|
2008-09-02 09:13:20 +02:00
|
|
|
|
2009-02-25 15:53:31 +01:00
|
|
|
/**
|
|
|
|
* Sets a configuration property with the specified name and value.
|
|
|
|
* To override this method properly, you must call the super class:
|
|
|
|
* <pre>
|
|
|
|
* public boolean setOption(String name, Object value) {
|
|
|
|
* if (super.setOption(name, value)) {
|
|
|
|
* return true;
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* if (name.equals("additionalOption")) {
|
|
|
|
* ....
|
|
|
|
* return true;
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* return false;
|
|
|
|
* }
|
|
|
|
* </pre>
|
|
|
|
*
|
|
|
|
* @return {@code true} if and only if the property has been set
|
|
|
|
*/
|
|
|
|
boolean setOption(String name, Object value);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|