public class ExpirationAttributes extends Object implements DataSerializable
timeToLive
and idleTimeout
. If the expiration action is not specified,
it defaults to ExpirationAction.INVALIDATE
. If the timeout is not specified, it
defaults to zero (which means to never timeout).AttributesFactory
,
RegionAttributes
,
AttributesMutator
,
Serialized FormDataSerializable.Replaceable
Modifier and Type | Field and Description |
---|---|
static ExpirationAttributes |
DEFAULT
convenience constant for a default instance
|
Constructor and Description |
---|
ExpirationAttributes()
Constructs a default
ExpirationAttributes , which indicates no expiration will take
place. |
ExpirationAttributes(int expirationTime)
Constructs an
ExpirationAttributes with the specified expiration time and the
default expiration action ExpirationAction.INVALIDATE . |
ExpirationAttributes(int expirationTime,
ExpirationAction expirationAction)
Constructs an
ExpirationAttributes with the specified expiration time and
expiration action. |
Modifier and Type | Method and Description |
---|---|
static ExpirationAttributes |
createFromData(DataInput in) |
boolean |
equals(Object obj) |
void |
fromData(DataInput in)
Reads the state of this object as primitive data from the given
DataInput . |
ExpirationAction |
getAction()
Returns the action that should take place when this value or region expires.
|
int |
getTimeout()
Returns the number of seconds before a region or value expires.
|
int |
hashCode() |
boolean |
isDefault() |
void |
toData(DataOutput out)
Writes the state of this object as primitive data to the given
DataOutput . |
String |
toString()
Returns a string representation of this
ExpirationAttributes . |
@Immutable public static final ExpirationAttributes DEFAULT
public ExpirationAttributes()
ExpirationAttributes
, which indicates no expiration will take
place.public ExpirationAttributes(int expirationTime)
ExpirationAttributes
with the specified expiration time and the
default expiration action ExpirationAction.INVALIDATE
.expirationTime
- The number of seconds before expirationIllegalArgumentException
- if expirationTime is nonpositivepublic ExpirationAttributes(int expirationTime, ExpirationAction expirationAction)
ExpirationAttributes
with the specified expiration time and
expiration action.expirationTime
- The number of seconds for a value to live before it expires. If this
parameter is negative, the expiration time will be set to 0, indicating no expiration.expirationAction
- the action to take when the value expirespublic int getTimeout()
public ExpirationAction getAction()
public String toString()
ExpirationAttributes
. If the timeout is
zero, returns "NO EXPIRATION"
.public static ExpirationAttributes createFromData(DataInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public void fromData(DataInput in) throws IOException, ClassNotFoundException
DataSerializable
DataInput
.fromData
in interface DataSerializable
in
- the DataInput
to read fromIOException
- A problem occurs while reading from in
ClassNotFoundException
- A class could not be loaded while reading from in
public void toData(DataOutput out) throws IOException
DataSerializable
DataOutput
.
Since 5.7 it is possible for any method call to the specified DataOutput
to throw
GemFireRethrowable
. It should not be caught by user code. If it is it
must be rethrown.
toData
in interface DataSerializable
out
- the DataOutput
to write toIOException
- A problem occurs while writing to out
public boolean isDefault()