org.glassfish.ha.store.util
Class SimpleMetadata

java.lang.Object
  extended by org.glassfish.ha.store.util.SimpleMetadata
All Implemented Interfaces:
Serializable, Storeable

public class SimpleMetadata
extends Object
implements Storeable

See Also:
Serialized Form

Constructor Summary
SimpleMetadata()
           
SimpleMetadata(long version, long lastAccesstime, long maxInactiveInterval, byte[] state)
          Construct a SimpleMetadata object
 
Method Summary
 String[] _storeable_getAttributeNames()
          Providers can cache this
 boolean[] _storeable_getDirtyStatus()
          Providers can cache this
 long _storeable_getLastAccessTime()
           
 long _storeable_getMaxIdleTime()
           
 long _storeable_getVersion()
          Get the version of this entry.
 void _storeable_readState(InputStream is)
           
 void _storeable_setLastAccessTime(long val)
           
 void _storeable_setMaxIdleTime(long val)
           
 void _storeable_setVersion(long val)
           
 void _storeable_writeState(OutputStream os)
           
 long getLastAccessTime()
          Get the last access time of the state.
 long getMaxInactiveInterval()
          Get the maximum time that this state can be idle in the store before it can be removed.
 byte[] getState()
           
 long getVersion()
          Get the verion of the state.
 void setLastAccessTime(long lastAccessTime)
           
 void setMaxInactiveInterval(long maxInactiveInterval)
           
 void setState(byte[] state)
           
 void setVersion(long version)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleMetadata

public SimpleMetadata()

SimpleMetadata

public SimpleMetadata(long version,
                      long lastAccesstime,
                      long maxInactiveInterval,
                      byte[] state)
Construct a SimpleMetadata object

Parameters:
version - The version of the data. A freshly created state has a version == 0
lastAccesstime - the last access time of the state. This must be used in conjunction with getMaxInactiveInterval to determine if the state is idle enough to be removed.
maxInactiveInterval - the maximum time that this state can be idle in the store before it can be removed.
Method Detail

getVersion

public long getVersion()
Get the verion of the state. A freshly created state has a version == 0

Returns:
the version.

setVersion

public void setVersion(long version)

getLastAccessTime

public long getLastAccessTime()
Get the last access time of the state. This must be used in conjunction with getMaxInactiveInterval to determine if the state is idle enough to be removed.

Returns:
The time when the state was accessed last

setLastAccessTime

public void setLastAccessTime(long lastAccessTime)

getMaxInactiveInterval

public long getMaxInactiveInterval()
Get the maximum time that this state can be idle in the store before it can be removed.

Returns:
the maximum idle time. If zero or negative, then the component has no idle timeout limit

setMaxInactiveInterval

public void setMaxInactiveInterval(long maxInactiveInterval)

getState

public byte[] getState()

setState

public void setState(byte[] state)

toString

public String toString()
Overrides:
toString in class Object

_storeable_getVersion

public long _storeable_getVersion()
Description copied from interface: Storeable
Get the version of this entry. -1 means that this entry has no version

Specified by:
_storeable_getVersion in interface Storeable
Returns:
The version or null if this entry has no version

_storeable_setVersion

public void _storeable_setVersion(long val)
Specified by:
_storeable_setVersion in interface Storeable

_storeable_getLastAccessTime

public long _storeable_getLastAccessTime()
Specified by:
_storeable_getLastAccessTime in interface Storeable

_storeable_setLastAccessTime

public void _storeable_setLastAccessTime(long val)
Specified by:
_storeable_setLastAccessTime in interface Storeable

_storeable_getMaxIdleTime

public long _storeable_getMaxIdleTime()
Specified by:
_storeable_getMaxIdleTime in interface Storeable

_storeable_setMaxIdleTime

public void _storeable_setMaxIdleTime(long val)
Specified by:
_storeable_setMaxIdleTime in interface Storeable

_storeable_getAttributeNames

public String[] _storeable_getAttributeNames()
Description copied from interface: Storeable
Providers can cache this

Specified by:
_storeable_getAttributeNames in interface Storeable
Returns:
an array of attribute names

_storeable_getDirtyStatus

public boolean[] _storeable_getDirtyStatus()
Description copied from interface: Storeable
Providers can cache this

Specified by:
_storeable_getDirtyStatus in interface Storeable
Returns:
A boolean array each representing the dirty status of the attribute whose name can be found at the same index in the array returned by _getAttributeNames()

_storeable_writeState

public void _storeable_writeState(OutputStream os)
                           throws IOException
Specified by:
_storeable_writeState in interface Storeable
Throws:
IOException

_storeable_readState

public void _storeable_readState(InputStream is)
                          throws IOException
Specified by:
_storeable_readState in interface Storeable
Throws:
IOException


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.