Class InMemoryLinkedDataStore
- java.lang.Object
-
- net.timewalker.ffmq4.storage.data.impl.AbstractDataStore
-
- net.timewalker.ffmq4.storage.data.impl.InMemoryLinkedDataStore
-
- All Implemented Interfaces:
DataStore,LinkedDataStore
public final class InMemoryLinkedDataStore extends AbstractDataStore
InMemoryLinkedObjectStore
-
-
Field Summary
-
Fields inherited from class net.timewalker.ffmq4.storage.data.impl.AbstractDataStore
locks, SAFE_MODE
-
-
Constructor Summary
Constructors Constructor Description InMemoryLinkedDataStore(String name, int initialSize, int maxSize)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckHandle(int handle)Check handle validityvoidclose()Close the store releasing associated system resourcesvoidcommitChanges()Ensure everything's persisted (synchronous)voidcommitChanges(SynchronizationBarrier barrier)Ensure everything's persisted (asynchronous)intdelete(int handle)Delete data associated to the given handle from the storeintfirst()Get the first data handle storedintgetAbsoluteStoreUsage()Get the absolute store usage amount (%) (Ratio of used space over maximum allocatable space)intgetStoreUsage()Get the store usage amount (%) (Ratio of used space over currently allocated space)voidinit()Initialize the data storeintnext(int handle)Get the next data handle after the given oneintprevious(int handle)Get the previous data handle after the given oneintreplace(int handle, Object obj)Replace data in the store at the given positionObjectretrieve(int handle)Retrieve the data associated to a given handleintsize()Get the number of entries in the storeintstore(Object obj, int previousHandle)Put some data under in the store after the previous handle dataStringtoString()-
Methods inherited from class net.timewalker.ffmq4.storage.data.impl.AbstractDataStore
isLocked, lock, unlock
-
-
-
-
Constructor Detail
-
InMemoryLinkedDataStore
public InMemoryLinkedDataStore(String name, int initialSize, int maxSize)
Constructor
-
-
Method Detail
-
init
public void init() throws DataStoreExceptionDescription copied from interface:LinkedDataStoreInitialize the data store- Throws:
DataStoreException
-
checkHandle
protected void checkHandle(int handle) throws DataStoreExceptionDescription copied from class:AbstractDataStoreCheck handle validity- Specified by:
checkHandlein classAbstractDataStore- Throws:
DataStoreException
-
retrieve
public Object retrieve(int handle) throws DataStoreException
Description copied from interface:LinkedDataStoreRetrieve the data associated to a given handle- Throws:
DataStoreException- on storage error or invalid handle
-
replace
public int replace(int handle, Object obj) throws DataStoreExceptionDescription copied from interface:LinkedDataStoreReplace data in the store at the given position- Parameters:
handle- message handleobj- the message to store- Throws:
DataStoreException
-
store
public int store(Object obj, int previousHandle) throws DataStoreException
Description copied from interface:LinkedDataStorePut some data under in the store after the previous handle datapreviousHandle- previous entry handle, use 0 if the store is empty- Throws:
DataStoreException
-
delete
public int delete(int handle) throws DataStoreExceptionDescription copied from interface:LinkedDataStoreDelete data associated to the given handle from the store- Returns:
- the previous handle or -1
- Throws:
DataStoreException- on storage error or invalid handle
-
first
public int first() throws DataStoreExceptionDescription copied from interface:LinkedDataStoreGet the first data handle stored- Returns:
- the first entry handle or -1 if the store is empty
- Throws:
DataStoreException
-
next
public int next(int handle) throws DataStoreExceptionDescription copied from interface:LinkedDataStoreGet the next data handle after the given one- Parameters:
handle- block handle- Returns:
- the next entry handle or -1 if their is no successor
- Throws:
DataStoreException
-
previous
public int previous(int handle) throws DataStoreExceptionDescription copied from interface:LinkedDataStoreGet the previous data handle after the given one- Parameters:
handle- block handle- Returns:
- the previous entry handle or -1 if their is no predecessor
- Throws:
DataStoreException
-
size
public int size()
Description copied from interface:DataStoreGet the number of entries in the store
-
commitChanges
public void commitChanges(SynchronizationBarrier barrier) throws DataStoreException
Description copied from interface:DataStoreEnsure everything's persisted (asynchronous)- Throws:
DataStoreException
-
commitChanges
public void commitChanges() throws DataStoreExceptionDescription copied from interface:DataStoreEnsure everything's persisted (synchronous)- Throws:
DataStoreException
-
close
public void close()
Description copied from interface:DataStoreClose the store releasing associated system resources
-
getStoreUsage
public int getStoreUsage()
Description copied from interface:DataStoreGet the store usage amount (%) (Ratio of used space over currently allocated space)
-
getAbsoluteStoreUsage
public int getAbsoluteStoreUsage()
Description copied from interface:DataStoreGet the absolute store usage amount (%) (Ratio of used space over maximum allocatable space)
-
-