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  import java.net.SocketAddress;
    23  import java.util.EventListener;
    24
    25  /**
    26   * Something interested in being notified when the result
    27   * of an {@link IoFuture} becomes available.
    28   *
    29   * @author The Apache Directory Project (mina-dev@directory.apache.org)
    30   * @version $Rev: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (Fri, 13 Jul 2007) $
    31   */
    32  public interface IoServiceListener extends EventListener {
    33      /**
    34       * Invoked when a new service is activated by an {@link IoService}.
    35       *
    36       * @param service the {@link IoService}
    37       * @param serviceAddress the socket address of the {@link IoService} listens
    38       *                       to manage sessions.  If the service is an {@link IoAcceptor},
    39       *                       it is a bind address.  If the service is an {@link IoConnector},
    40       *                       it is a remote address.
    41       * @param handler the {@link IoHandler} that serves the new service
    42       * @param config  the {@link IoServiceConfig} of the new service
    43       */
    44      void serviceActivated(IoService service, SocketAddress serviceAddress,
    45              IoHandler handler, IoServiceConfig config);
    46
    47      /**
    48       * Invoked when a service is deactivated by an {@link IoService}.
    49       *
    50       * @param service the {@link IoService}
    51       * @param serviceAddress the socket address of the {@link IoService} listens
    52       *                       to manage sessions.  If the service is an {@link IoAcceptor},
    53       *                       it is a bind address.  If the service is an {@link IoConnector},
    54       *                       it is a remote address.
    55       * @param handler the {@link IoHandler} that serves the service
    56       * @param config  the {@link IoServiceConfig} of the service
    57       */
    58      void serviceDeactivated(IoService service, SocketAddress serviceAddress,
    59              IoHandler handler, IoServiceConfig config);
    60
    61      /**
    62       * Invoked when a new session is created by an {@link IoService}.
    63       *
    64       * @param session the new session
    65       */
    66      void sessionCreated(IoSession session);
    67
    68      /**
    69       * Invoked when a session is being destroyed by an {@link IoService}.
    70       *
    71       * @param session the session to be destroyed
    72       */
    73      void sessionDestroyed(IoSession session);
    74  }