VMware GemFire Java API Reference
Package org.apache.geode.cache
Class ExpirationAttributes
- java.lang.Object
-
- org.apache.geode.cache.ExpirationAttributes
-
- All Implemented Interfaces:
java.io.Serializable,DataSerializable
public class ExpirationAttributes extends java.lang.Object implements DataSerializable
Immutable parameter object for accessing and setting the attributes associated withtimeToLiveandidleTimeout. If the expiration action is not specified, it defaults toExpirationAction.INVALIDATE. If the timeout is not specified, it defaults to zero (which means to never timeout).- Since:
- GemFire 3.0
- See Also:
AttributesFactory,RegionAttributes,AttributesMutator, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.geode.DataSerializable
DataSerializable.Replaceable
-
-
Field Summary
Fields Modifier and Type Field Description static ExpirationAttributesDEFAULTconvenience constant for a default instance
-
Constructor Summary
Constructors Constructor Description ExpirationAttributes()Constructs a defaultExpirationAttributes, which indicates no expiration will take place.ExpirationAttributes(int expirationTime)Constructs anExpirationAttributeswith the specified expiration time and the default expiration actionExpirationAction.INVALIDATE.ExpirationAttributes(int expirationTime, ExpirationAction expirationAction)Constructs anExpirationAttributeswith the specified expiration time and expiration action.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExpirationAttributescreateFromData(java.io.DataInput in)booleanequals(java.lang.Object obj)voidfromData(java.io.DataInput in)Reads the state of this object as primitive data from the givenDataInput.ExpirationActiongetAction()Returns the action that should take place when this value or region expires.intgetTimeout()Returns the number of seconds before a region or value expires.inthashCode()booleanisDefault()voidtoData(java.io.DataOutput out)Writes the state of this object as primitive data to the givenDataOutput.java.lang.StringtoString()Returns a string representation of thisExpirationAttributes.
-
-
-
Field Detail
-
DEFAULT
@Immutable public static final ExpirationAttributes DEFAULT
convenience constant for a default instance
-
-
Constructor Detail
-
ExpirationAttributes
public ExpirationAttributes()
Constructs a defaultExpirationAttributes, which indicates no expiration will take place.
-
ExpirationAttributes
public ExpirationAttributes(int expirationTime)
Constructs anExpirationAttributeswith the specified expiration time and the default expiration actionExpirationAction.INVALIDATE.- Parameters:
expirationTime- The number of seconds before expiration- Throws:
java.lang.IllegalArgumentException- if expirationTime is nonpositive
-
ExpirationAttributes
public ExpirationAttributes(int expirationTime, ExpirationAction expirationAction)Constructs anExpirationAttributeswith the specified expiration time and expiration action.- Parameters:
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 expires
-
-
Method Detail
-
getTimeout
public int getTimeout()
Returns the number of seconds before a region or value expires.- Returns:
- the relative number of seconds before a region or value expires or zero if it will never expire
-
getAction
public ExpirationAction getAction()
Returns the action that should take place when this value or region expires.- Returns:
- the action to take when expiring
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of thisExpirationAttributes. If the timeout is zero, returns"NO EXPIRATION".- Overrides:
toStringin classjava.lang.Object- Returns:
- the String representation of this expiration attribute
-
createFromData
public static ExpirationAttributes createFromData(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
fromData
public void fromData(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionDescription copied from interface:DataSerializableReads the state of this object as primitive data from the givenDataInput.- Specified by:
fromDatain interfaceDataSerializable- Parameters:
in- theDataInputto read from- Throws:
java.io.IOException- A problem occurs while reading frominjava.lang.ClassNotFoundException- A class could not be loaded while reading fromin
-
toData
public void toData(java.io.DataOutput out) throws java.io.IOExceptionDescription copied from interface:DataSerializableWrites the state of this object as primitive data to the givenDataOutput.Since 5.7 it is possible for any method call to the specified
DataOutputto throwGemFireRethrowable. It should not be caught by user code. If it is it must be rethrown.- Specified by:
toDatain interfaceDataSerializable- Parameters:
out- theDataOutputto write to- Throws:
java.io.IOException- A problem occurs while writing toout
-
isDefault
public boolean isDefault()
-
-