|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.aselect.system.storagemanager.handler.MemoryStorageHandler
public class MemoryStorageHandler
memory storage handler.
Description:
The MemoryStorageHandler uses a Hashtable
for storing objects
in memory.
In the MemoryStorageHandler an additional Hashtable is created in which
information about the stored record is kept:
Hashtable htStorage {
key: Object xKey
value: Hashtable htStorageContainer {
key: String "timestamp" value: Long xTimestamp
key: String "contents" value: Object xValue }
}
Concurrency issues:
-
Field Summary | |
---|---|
static java.lang.String |
MODULE
The module name. |
Constructor Summary | |
---|---|
MemoryStorageHandler()
|
Method Summary | |
---|---|
void |
cleanup(java.lang.Long lTimestamp)
Removes the objects from memory table that have been expired. |
boolean |
containsKey(java.lang.Object oKey)
Checks if the supplied key already exists in the Hashtable
|
void |
destroy()
Clear the storage Hashtable . |
java.lang.Object |
get(java.lang.Object oKey)
Get a object from memory. |
java.util.Hashtable |
getAll()
Get all objects from memory table. |
long |
getCount()
Returns the number of objects stored in memory. |
long |
getTimestamp(java.lang.Object oKey)
Retrieve an object its timestamp from storage. |
void |
init(java.lang.Object oConfigSection,
ConfigManager oConfigManager,
SystemLogger systemLogger,
SAMAgent oSAMAgent)
Initialize the MemoryStorageHandler . |
boolean |
isMaximum(long lItemCount)
Checks if the configured maximum items is reached. |
void |
put(java.lang.Object oKey,
java.lang.Object oValue,
java.lang.Long lTimestamp)
Put object in memory. |
void |
remove(java.lang.Object oKey)
Remove an object from memory storage. |
void |
removeAll()
Remove all objects from memmory table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MODULE
Constructor Detail |
---|
public MemoryStorageHandler()
Method Detail |
---|
public void init(java.lang.Object oConfigSection, ConfigManager oConfigManager, SystemLogger systemLogger, SAMAgent oSAMAgent) throws ASelectStorageException
MemoryStorageHandler
.
MemoryStorageHandler
:
Hashtable
systemLogger != null
Hashmap
is created
init
in interface IStorageHandler
oConfigSection
- The section within the configuration file in which the
parameters for the IStorageHandler can be found.oConfigManager
- The configuration.systemLogger
- The logger for system entries.oSAMAgent
- The SAM agant to use.
ASelectStorageException
- If initialisation fails.IStorageHandler.init(java.lang.Object,
org.aselect.system.configmanager.ConfigManager,
org.aselect.system.logging.SystemLogger,
org.aselect.system.sam.agent.SAMAgent)
public java.lang.Object get(java.lang.Object oKey) throws ASelectStorageException
get
in interface IStorageHandler
oKey
- The identifier of the object that needs to be stored.
ASelectStorageException
- If retrieving fails.IStorageHandler.get(java.lang.Object)
public long getTimestamp(java.lang.Object oKey) throws ASelectStorageException
getTimestamp
in interface IStorageHandler
oKey
- The identifier of the object that needs to be obtained from
the storage.
ASelectStorageException
- If retrieving fails.IStorageHandler.getTimestamp(java.lang.Object)
public long getCount() throws ASelectStorageException
getCount
in interface IStorageHandler
ASelectStorageException
- If retrieving fails.IStorageHandler.getCount()
public java.util.Hashtable getAll() throws ASelectStorageException
getAll
in interface IStorageHandler
ASelectStorageException
- If retrieving fails.IStorageHandler.getAll()
public void put(java.lang.Object oKey, java.lang.Object oValue, java.lang.Long lTimestamp) throws ASelectStorageException
put
in interface IStorageHandler
oKey
- The identifier of the object that needs to be stored.oValue
- The object that needs to be stored.lTimestamp
- The time at which the object is stored.
ASelectStorageException
- If storing fails.IStorageHandler.put(java.lang.Object, java.lang.Object, java.lang.Long)
public void remove(java.lang.Object oKey) throws ASelectStorageException
remove
in interface IStorageHandler
oKey
- The identifier of the object that needs to be removed.
ASelectStorageException
- If removal fails.IStorageHandler.remove(java.lang.Object)
public void removeAll() throws ASelectStorageException
removeAll
in interface IStorageHandler
ASelectStorageException
- if removal fails.IStorageHandler.removeAll()
public void cleanup(java.lang.Long lTimestamp) throws ASelectStorageException
cleanup
in interface IStorageHandler
lTimestamp
- The expiration time.
ASelectStorageException
- If cleaning fails.IStorageHandler.cleanup(java.lang.Long)
public void destroy()
Hashtable
.
destroy
in interface IStorageHandler
IStorageHandler.destroy()
public boolean isMaximum(long lItemCount) throws ASelectStorageException
isMaximum
in interface IStorageHandler
lItemCount
- number of items that will be checked if it is the maximum
ASelectStorageException
- if io error occurred with physical storageIStorageHandler.isMaximum(long)
public boolean containsKey(java.lang.Object oKey) throws ASelectStorageException
Hashtable
containsKey
in interface IStorageHandler
oKey
- The unique key that will be checked for existance
ASelectStorageException
- if IO error occurred with physical storageIStorageHandler.containsKey(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |