Package com.boomi.connector.util
Class ExpiringValue<V>
- java.lang.Object
-
- com.boomi.connector.util.ExpiringValue<V>
-
- Direct Known Subclasses:
SimpleExpiringValue
public abstract class ExpiringValue<V> extends Object
Base class for tracking a value which needs to expire after a certain amount of time or inactivity. When the current value is no longer valid, get() will returnnull
.This class is not thread-safe. The expectation is that subtypes of this class will be used within a ConnectorCache instance which manages the thread-safety.
-
-
Constructor Summary
Constructors Constructor Description ExpiringValue()
ExpiringValue(V value)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description V
get()
Gets the current, valid value,null
otherwise.abstract boolean
isValid(V curValue)
Returnstrue
if the given value is still valid,false
otherwise.void
set(V value)
Sets the current value
-
-
-
Constructor Detail
-
ExpiringValue
public ExpiringValue()
-
ExpiringValue
public ExpiringValue(V value)
-
-
Method Detail
-
get
public V get()
Gets the current, valid value,null
otherwise. If the current value is not valid, it will be cleared by this call before returning.
-
set
public void set(V value)
Sets the current value
-
isValid
public abstract boolean isValid(V curValue)
Returnstrue
if the given value is still valid,false
otherwise.
-
-