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
AnIoSessionRecycler
with 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 int
getExpirationInterval()
int
getTimeToLive()
void
put(IoSession session)
Called when the underlying transport creates or writes a newIoSession
.IoSession
recycle(java.net.SocketAddress localAddress, java.net.SocketAddress remoteAddress)
Attempts to retrieve a recycledIoSession
.void
remove(IoSession session)
Called when anIoSession
is explicitly closed.void
setExpirationInterval(int expirationInterval)
void
setTimeToLive(int timeToLive)
void
stopExpiring()
-
-
-
Method Detail
-
put
public void put(IoSession session)
Description copied from interface:IoSessionRecycler
Called when the underlying transport creates or writes a newIoSession
.- Specified by:
put
in interfaceIoSessionRecycler
- Parameters:
session
- the newIoSession
.
-
recycle
public IoSession recycle(java.net.SocketAddress localAddress, java.net.SocketAddress remoteAddress)
Description copied from interface:IoSessionRecycler
Attempts to retrieve a recycledIoSession
.- Specified by:
recycle
in interfaceIoSessionRecycler
- Parameters:
localAddress
- the local socket address of theIoSession
the transport wants to recycle.remoteAddress
- the remote socket address of theIoSession
the 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:IoSessionRecycler
Called when anIoSession
is explicitly closed.- Specified by:
remove
in 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)
-
-