public final class ExpiryStrategy extends Object
When an ExpiryStrategy
is constructed, then an associated
thread is immediately constructed and started. This thread must
be stopped manually by calling stop()
as soon as the strategy is
no longer used.
Constructor and Description |
---|
ExpiryStrategy(long timeOut,
long precision)
Constructs a new
ExpiryStrategy and starts the
corresponding thread. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Checks whether this object is considered equal to the argument.
|
long |
getPrecision()
Returns the time-out precision.
|
int |
getSlotCount()
Returns the number of slots that should be used by expiry collections
that use this strategy.
|
long |
getTimeOut()
Returns the time-out.
|
int |
hashCode()
Returns a hash code value for the object.
|
void |
stop()
Stops the thread that generates ticks that are passed to the registered
expiry folders.
|
String |
toString()
Returns a textual representation of this object.
|
public ExpiryStrategy(long timeOut, long precision) throws IllegalArgumentException
ExpiryStrategy
and starts the
corresponding thread.timeOut
- the time-out, in milliseconds.precision
- the time-out precision, in milliseconds.IllegalArgumentException
- if timeOut < 1L
|| precision < 1L
|| timeOut < precision
public boolean equals(Object obj)
Two ExpiryStrategy
objects are considered equal if they
have the same time-out (see getTimeOut()
and the same precision
(see getPrecision()
.
equals
in class Object
obj
- the object to compare with.true
if this object is considered equal to
obj
, or false
otherwise.Object.equals(Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
,
equals(Object)
public long getTimeOut()
public long getPrecision()
public int getSlotCount()
public void stop() throws IllegalStateException
IllegalStateException
- if this strategy was already stopped.See http://www.xins.org/.