org.apache.mina.core.service

## Class IoServiceListenerSupport

- java.lang.Object
- - org.apache.mina.core.service.IoServiceListenerSupport

-     public class IoServiceListenerSupport
      extends Object

  A helper class which provides addition and removal of `IoServiceListener`s and firing events.
  Author:
    Apache MINA Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IoServiceListenerSupport(IoService service)` Creates a new instance of the listenerSupport.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(IoServiceListener listener)` Adds a new listener.
    `void` | `fireServiceActivated()` Calls `IoServiceListener.serviceActivated(IoService)` for all registered listeners.
    `void` | `fireServiceDeactivated()` Calls `IoServiceListener.serviceDeactivated(IoService)` for all registered listeners.
    `void` | `fireSessionCreated(IoSession session)` Calls `IoServiceListener.sessionCreated(IoSession)` for all registered listeners.
    `void` | `fireSessionDestroyed(IoSession session)` Calls `IoServiceListener.sessionDestroyed(IoSession)` for all registered listeners.
    `long` | `getActivationTime()`
    `long` | `getCumulativeManagedSessionCount()`
    `int` | `getLargestManagedSessionCount()`
    `int` | `getManagedSessionCount()`
    `Map<Long,IoSession>` | `getManagedSessions()`
    `boolean` | `isActive()`
    `void` | `remove(IoServiceListener listener)` Removes an existing listener.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IoServiceListenerSupport

          public IoServiceListenerSupport(IoService service)

      Creates a new instance of the listenerSupport.
      Parameters:
        `service` - The associated IoService

  - ### Method Detail

    - #### add

          public void add(IoServiceListener listener)

      Adds a new listener.
      Parameters:
        `listener` - The added listener

    - #### remove

          public void remove(IoServiceListener listener)

      Removes an existing listener.
      Parameters:
        `listener` - The listener to remove

    - #### getActivationTime

          public long getActivationTime()

      Returns:
        The time (in ms) this instance has been activated

    - #### getManagedSessions

          public Map<Long,IoSession> getManagedSessions()

    - #### getManagedSessionCount

          public int getManagedSessionCount()

    - #### getLargestManagedSessionCount

          public int getLargestManagedSessionCount()

      Returns:
        The largest number of managed session since the creation of this listenerSupport

    - #### getCumulativeManagedSessionCount

          public long getCumulativeManagedSessionCount()

      Returns:
        The total number of sessions managed since the initilization of this ListenerSupport

    - #### isActive

          public boolean isActive()

      Returns:
        true if the instance is active

    - #### fireServiceActivated

          public void fireServiceActivated()

      Calls `IoServiceListener.serviceActivated(IoService)` for all registered listeners.

    - #### fireServiceDeactivated

          public void fireServiceDeactivated()

      Calls `IoServiceListener.serviceDeactivated(IoService)` for all registered listeners.

    - #### fireSessionCreated

          public void fireSessionCreated(IoSession session)

      Calls `IoServiceListener.sessionCreated(IoSession)` for all registered listeners.
      Parameters:
        `session` - The session which has been created

    - #### fireSessionDestroyed

          public void fireSessionDestroyed(IoSession session)

      Calls `IoServiceListener.sessionDestroyed(IoSession)` for all registered listeners.
      Parameters:
        `session` - The session which has been destroyed

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.