|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.collections.expiry.ExpiryStrategy
Expiry strategy. A strategy maintains a time-out and a time-out precision.
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 Summary | |
ExpiryStrategy(long timeOut,
long precision)
Constructs a new ExpiryStrategy and starts the
corresponding thread. |
Method Summary | |
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. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
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
Method Detail |
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()
.
obj
- the object to compare with.
true
if this object is considered equal to
obj
, or false
otherwise.Object.equals(Object)
public int hashCode()
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.public String toString()
null
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |