Package org.apache.mina.util
Class ExpiringMap.Expirer
- java.lang.Object
-
- org.apache.mina.util.ExpiringMap.Expirer
-
- All Implemented Interfaces:
Runnable
- Enclosing class:
- ExpiringMap<K,V>
public class ExpiringMap.Expirer extends Object implements Runnable
A Thread that monitors anExpiringMapand will remove elements that have passed the threshold.
-
-
Constructor Summary
Constructors Constructor Description Expirer()Creates a new instance of Expirer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetExpirationInterval()Get the interval in which an object will live in the map before it is removed.intgetTimeToLive()booleanisRunning()Checks to see if the thread is runningvoidrun()voidsetExpirationInterval(long expirationInterval)Set the interval in which an object will live in the map before it is removed.voidsetTimeToLive(long timeToLive)Update the value for the time-to-livevoidstartExpiring()Kick off this thread which will look for old objects and remove them.voidstartExpiringIfNotStarted()If this thread has not started, then start it.voidstopExpiring()Stop the thread from monitoring the map.
-
-
-
Method Detail
-
startExpiring
public void startExpiring()
Kick off this thread which will look for old objects and remove them.
-
startExpiringIfNotStarted
public void startExpiringIfNotStarted()
If this thread has not started, then start it. Otherwise just return;
-
stopExpiring
public void stopExpiring()
Stop the thread from monitoring the map.
-
isRunning
public boolean isRunning()
Checks to see if the thread is running- Returns:
- If the thread is running, true. Otherwise false.
-
getTimeToLive
public int getTimeToLive()
- Returns:
- the Time-to-live value in seconds.
-
setTimeToLive
public void setTimeToLive(long timeToLive)
Update the value for the time-to-live- Parameters:
timeToLive- The time-to-live (seconds)
-
getExpirationInterval
public int getExpirationInterval()
Get the interval in which an object will live in the map before it is removed.- Returns:
- The time in seconds.
-
setExpirationInterval
public void setExpirationInterval(long expirationInterval)
Set the interval in which an object will live in the map before it is removed.- Parameters:
expirationInterval- The time in seconds
-
-