Package org.apache.mina.common
Class ExpiringSessionRecycler
- java.lang.Object
-
- org.apache.mina.common.ExpiringSessionRecycler
-
- All Implemented Interfaces:
IoSessionRecycler
public class ExpiringSessionRecycler extends java.lang.Object implements IoSessionRecycler
AnIoSessionRecyclerwith sessions that time out on inactivity. TODO Document me.
-
-
Field Summary
-
Fields inherited from interface org.apache.mina.common.IoSessionRecycler
NOOP
-
-
Constructor Summary
Constructors Constructor Description ExpiringSessionRecycler()ExpiringSessionRecycler(int timeToLive)ExpiringSessionRecycler(int timeToLive, int expirationInterval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetExpirationInterval()intgetTimeToLive()voidput(IoSession session)Called when the underlying transport creates or writes a newIoSession.IoSessionrecycle(java.net.SocketAddress localAddress, java.net.SocketAddress remoteAddress)Attempts to retrieve a recycledIoSession.voidremove(IoSession session)Called when anIoSessionis explicitly closed.voidsetExpirationInterval(int expirationInterval)voidsetTimeToLive(int timeToLive)voidstopExpiring()
-
-
-
Method Detail
-
put
public void put(IoSession session)
Description copied from interface:IoSessionRecyclerCalled when the underlying transport creates or writes a newIoSession.- Specified by:
putin interfaceIoSessionRecycler- Parameters:
session- the newIoSession.
-
recycle
public IoSession recycle(java.net.SocketAddress localAddress, java.net.SocketAddress remoteAddress)
Description copied from interface:IoSessionRecyclerAttempts to retrieve a recycledIoSession.- Specified by:
recyclein interfaceIoSessionRecycler- Parameters:
localAddress- the local socket address of theIoSessionthe transport wants to recycle.remoteAddress- the remote socket address of theIoSessionthe transport wants to recycle.- Returns:
- a recycled
IoSession, or null if one cannot be found.
-
remove
public void remove(IoSession session)
Description copied from interface:IoSessionRecyclerCalled when anIoSessionis explicitly closed.- Specified by:
removein interfaceIoSessionRecycler- Parameters:
session- the newIoSession.
-
stopExpiring
public void stopExpiring()
-
getExpirationInterval
public int getExpirationInterval()
-
getTimeToLive
public int getTimeToLive()
-
setExpirationInterval
public void setExpirationInterval(int expirationInterval)
-
setTimeToLive
public void setTimeToLive(int timeToLive)
-
-