org.apache.mina.common

Class ExpiringSessionRecycler

Implemented Interfaces:
IoSessionRecycler

public class ExpiringSessionRecycler
extends java.lang.Object
implements IoSessionRecycler

An IoSessionRecycler with sessions that time out on inactivity. TODO Document me.

Fields inherited from interface org.apache.mina.common.IoSessionRecycler

NOOP

Constructor Summary

ExpiringSessionRecycler()
ExpiringSessionRecycler(int timeToLive)
ExpiringSessionRecycler(int timeToLive, int expirationInterval)

Method Summary

int
getExpirationInterval()
int
getTimeToLive()
void
put(IoSession session)
Called when the underlying transport creates or writes a new IoSession.
IoSession
recycle(SocketAddress localAddress, SocketAddress remoteAddress)
Attempts to retrieve a recycled IoSession.
void
remove(IoSession session)
Called when an IoSession is explicitly closed.
void
setExpirationInterval(int expirationInterval)
void
setTimeToLive(int timeToLive)
void
stopExpiring()

Constructor Details

ExpiringSessionRecycler

public ExpiringSessionRecycler()

ExpiringSessionRecycler

public ExpiringSessionRecycler(int timeToLive)

ExpiringSessionRecycler

public ExpiringSessionRecycler(int timeToLive,
                               int expirationInterval)

Method Details

getExpirationInterval

public int getExpirationInterval()

getTimeToLive

public int getTimeToLive()

put

public void put(IoSession session)
Called when the underlying transport creates or writes a new IoSession.
Specified by:
put in interface IoSessionRecycler
Parameters:
session - the new IoSession.

recycle

public IoSession recycle(SocketAddress localAddress,
                         SocketAddress remoteAddress)
Attempts to retrieve a recycled IoSession.
Specified by:
recycle in interface IoSessionRecycler
Parameters:
localAddress - the local socket address of the IoSession the transport wants to recycle.
remoteAddress - the remote socket address of the IoSession the transport wants to recycle.
Returns:
a recycled IoSession, or null if one cannot be found.

remove

public void remove(IoSession session)
Called when an IoSession is explicitly closed.
Specified by:
remove in interface IoSessionRecycler
Parameters:
session - the new IoSession.

setExpirationInterval

public void setExpirationInterval(int expirationInterval)

setTimeToLive

public void setTimeToLive(int timeToLive)

stopExpiring

public void stopExpiring()