FileDocCategorySizeDatePackage
BackingStore.javaAPI DocGlassfish v2 API6499Fri May 04 22:35:26 BST 2007com.sun.appserv.ha.spi

BackingStore

public abstract class BackingStore extends Object
An object that stores a given Metadata against an id. This class defines the set of operations that a container could perform on a store.

An instance of BackingStore is created by calling BackingStoreFactory.createSimpleStore() method.

The BackingStore instance is created and used for storing data that belongs to a single application or container.

The store implementation must be thread safe.

Fields Summary
private String
appId
private Properties
props
Constructors Summary
Methods Summary
public abstract voiddestroy()
Called when the store is no longer needed. Must clean up and close any opened resources.

protected java.lang.StringgetAppId()

        return this.appId;
    
protected java.util.PropertiesgetProperties()

        return props;
    
protected voidinitialize(java.lang.String appId, java.util.Properties props)

        this.appId = appId;
        this.props = props;
    
public abstract Kload(java.lang.String id)
Load and return the daata for the given id. The store is expected to return the largest ever version that was saved in the stored using the save() method. Note that the return value could be null if Metadata was not accessed for {@link Metadata#getMaxInactiveInterval()}

param
id the id whose value must be returned
return
the value if this store contains it or null. The implementation must return the exact same type as that was passed to it in the save method.
throws
NullPointerException if the id is null
throws
BackingStoreException if the underlying store implementation encounters any exception

public abstract voidremove(java.lang.String id)
Remove the association for the id. After this call, any call to load(id) must return null

param
id the id
return
true if the id was successfully removed false otherwise
throws
BackingStoreException if the underlying store implementation encounters any exception

public abstract intremoveExpired()
Remove all instances that are idle. The implementation of this method must use {@link Metadata#getLastAccessTime()} and {@link Metadata#getMaxInactiveInterval()} to determine if a particular Metadata is idle or not. A Metadata is considered idle if (Metadata.getMaxInactiveInterval > 0) && ((System.currentTimeMillis() - Metadata.getLastAccessTime()) >= Metadata.getMaxInactiveInterval())

return
The number of (idle) sessions removed.
throws
BackingStoreException if the underlying store implementation encounters any exception

public abstract voidsave(java.lang.String id, K value)
Save the value whose key is id.

param
id the id
param
value The Metadata to be stored
throws
BackingStoreException if the underlying store implementation encounters any exception

public abstract intsize()
Get the current size of the store

return
the number of entries in the store
throws
BackingStoreException if the underlying store implementation encounters any exception

public abstract voidupdateLastAccessTime(java.lang.String id, long time, long version)
Update the last access time for this id.

param
id the id for the Metadata
param
time the time at which this data was last accessed
param
version the new version number for the data associated with this id. A newly created version will have version number zero.
throws
BackingStoreException if the underlying store implementation encounters any exception