View Javadoc

    1   /*
    2    *  Licensed to the Apache Software Foundation (ASF) under one
    3    *  or more contributor license agreements.  See the NOTICE file
    4    *  distributed with this work for additional information
    5    *  regarding copyright ownership.  The ASF licenses this file
    6    *  to you under the Apache License, Version 2.0 (the
    7    *  "License"); you may not use this file except in compliance
    8    *  with the License.  You may obtain a copy of the License at
    9    *
    10   *    http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   *  Unless required by applicable law or agreed to in writing,
    13   *  software distributed under the License is distributed on an
    14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15   *  KIND, either express or implied.  See the License for the
    16   *  specific language governing permissions and limitations
    17   *  under the License.
    18   *
    19   */
    20  package org.apache.mina.common;
    21
    22  /**
    23   * A configuration which is used to configure {@link IoService}.
    24   *
    25   * @author The Apache Directory Project (mina-dev@directory.apache.org)
    26   * @version $Rev: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (Fri, 13 Jul 2007) $
    27   */
    28  public interface IoServiceConfig extends Cloneable {
    29      /**
    30       * Resturns the default configuration of the new {@link IoSession}s.
    31       */
    32      IoSessionConfig getSessionConfig();
    33
    34      /**
    35       * Returns the {@link IoFilterChainBuilder} which will modify the
    36       * {@link IoFilterChain} of all {@link IoSession}s which is created
    37       * with this configuration.
    38       * The default value is an empty {@link DefaultIoFilterChainBuilder}.
    39       */
    40      IoFilterChainBuilder getFilterChainBuilder();
    41
    42      /**
    43       * Sets the {@link IoFilterChainBuilder} which will modify the
    44       * {@link IoFilterChain} of all {@link IoSession}s which is created
    45       * with this configuration.
    46       * If you specify <tt>null</tt> this property will be set to
    47       * an empty {@link DefaultIoFilterChainBuilder}.
    48       */
    49      void setFilterChainBuilder(IoFilterChainBuilder builder);
    50
    51      /**
    52       * A shortcut for <tt>( ( DefaultIoFilterChainBuilder ) </tt>{@link #getFilterChainBuilder()}<tt> )</tt>.
    53       * Please note that the returned object is not a <b>real</b> {@link IoFilterChain}
    54       * but a {@link DefaultIoFilterChainBuilder}.  Modifying the returned builder
    55       * won't affect the existing {@link IoSession}s at all, because
    56       * {@link IoFilterChainBuilder}s affect only newly created {@link IoSession}s.
    57       *
    58       * @throws IllegalStateException if the current {@link IoFilterChainBuilder} is
    59       *                               not a {@link DefaultIoFilterChainBuilder}
    60       */
    61      DefaultIoFilterChainBuilder getFilterChain();
    62
    63      /**
    64       * Returns the default {@link ThreadModel} of the {@link IoService}.
    65       * The default value is a {@link ExecutorThreadModel}() whose service name is
    66       * <tt>'AnonymousIoService'</tt> and which has 16 maximum active threads.
    67       * It is strongly recommended to set a new {@link ExecutorThreadModel} by calling
    68       * {@link ExecutorThreadModel#getInstance(String)}.
    69       */
    70      ThreadModel getThreadModel();
    71
    72      /**
    73       * Sets the default {@link ThreadModel} of the {@link IoService}.
    74       * If you specify <tt>null</tt>, this property will be set to the
    75       * default value.
    76       * The default value is an {@link ExecutorThreadModel} whose service name is
    77       * <tt>'AnonymousIoService'</tt> with 16 threads.
    78       * It is strongly recommended to set a new {@link ExecutorThreadModel} by calling
    79       * {@link ExecutorThreadModel#getInstance(String)}.
    80       */
    81      void setThreadModel(ThreadModel threadModel);
    82
    83      /**
    84       * Returns a deep clone of this configuration.
    85       */
    86      Object clone();
    87  }