public class Volatile<T> extends Object
if (myVolatileValue.expired()) {
...evaluate the value...
myVolatileValue.set(myNewValue);
}
return myVolatileValue.get();
| Constructor and Description |
|---|
Volatile(long period) |
Volatile(long period,
T value)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate()
activate
|
boolean |
expired()
expired
|
T |
get() |
T |
invalidate() |
T |
set(T value) |
String |
toString() |
public Volatile(long period)
public Volatile(long period,
T value)
period - of milliseconds to hold the value. this should be a value smaller than 1sec (< 1000)value - (optional) initial value.Copyright © 2012–2018. All rights reserved.