org.apache.mina.service.idlechecker

## Class IndexedIdleChecker

- java.lang.Object
- - org.apache.mina.service.idlechecker.IndexedIdleChecker

All Implemented Interfaces:
  IdleChecker

    public class IndexedIdleChecker
    extends Object
    implements IdleChecker

An session idle detector using an index in place of polling every session every seconds.
For each session read/write event :

- we calculate what is the supposed future idle date
- we round it at the next second
- we store a reference to this session in a circular buffer like :

                   +--- Current time
                   |
                   v
     +---+---+...+---+---+...+---+
     | 0 | 1 |   | T |T+1|   |599|
     +---+---+...+---+---+...+---+
                   |   |
                   |   +--> { S2, S7, S12...} (sessions that will TO in one second)
                   +------> { S5, S6, S8...} (sessions that are idle for the maximum delay of 1 hour )

The maximum idle itme is one hour.

Author:
  Apache MINA Project

### Constructor Summary

Constructors
Constructor and Description
`IndexedIdleChecker()`

### Method Summary

Methods
`void` `destroy()` Stop the idle checker.
`int` `processIdleSession(long timeMs)` Find idle session, to be called for each select() call.
`void` `sessionRead(AbstractIoSession session, long timeInMs)` Inform the IdleCheker a session have a read event
`void` `sessionWritten(AbstractIoSession session, long timeInMs)` Inform the IdleCheker a session have a write event
`void` `start()` Start the idle checker inner threads

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

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

### Constructor Detail

#### IndexedIdleChecker

    public IndexedIdleChecker()

### Method Detail

#### start

    public void start()

Start the idle checker inner threads

Specified by:
  `start` in interface `IdleChecker`

#### destroy

    public void destroy()

Stop the idle checker.

Specified by:
  `destroy` in interface `IdleChecker`

#### sessionRead

    public void sessionRead(AbstractIoSession session,
                   long timeInMs)

Inform the IdleCheker a session have a read event

Specified by:
  `sessionRead` in interface `IdleChecker`
Parameters:
  `session` - the session with the read event
  `timeInMs` - the data in ms (unix time) of the event

#### sessionWritten

    public void sessionWritten(AbstractIoSession session,
                      long timeInMs)

Inform the IdleCheker a session have a write event

Specified by:
  `sessionWritten` in interface `IdleChecker`
Parameters:
  `session` - the session with the write event
  `timeInMs` - the data in ms (unix time) of the event

#### processIdleSession

    public int processIdleSession(long timeMs)

Find idle session, to be called for each select() call.

Specified by:
  `processIdleSession` in interface `IdleChecker`
Parameters:
  `timeMs` - current unix time in ms
Returns:
  the number of idle event detected