Package org.glassfish.ha.store.impl
Class NoOpBackingStore<K extends Serializable,V extends Serializable>
- java.lang.Object
-
- org.glassfish.ha.store.api.BackingStore<K,V>
-
- org.glassfish.ha.store.impl.NoOpBackingStore<K,V>
-
public class NoOpBackingStore<K extends Serializable,V extends Serializable> extends BackingStore<K,V>
- Author:
- Mahesh Kannan
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Called when the store is no longer needed.BackingStoreFactorygetBackingStoreFactory()protected voidinitialize(BackingStoreConfiguration<K,V> conf)Vload(K key, String version)Load and return the data for the given id.voidremove(K key)Remove the association for the id.intremoveExpired()Remove expired entriesStringsave(K key, V value, boolean isNew)Save the value whose key is id.intsize()Get the current size of the storeStringupdateTimestamp(K key, String version, Long accessTime)Recomended way is to just do a save(k, v)-
Methods inherited from class org.glassfish.ha.store.api.BackingStore
close, createObjectInputStream, createObjectOutputStream, getBackingStoreConfiguration, removeExpired, updateTimestamp
-
-
-
-
Method Detail
-
initialize
protected void initialize(BackingStoreConfiguration<K,V> conf) throws BackingStoreException
- Overrides:
initializein classBackingStore<K extends Serializable,V extends Serializable>- Throws:
BackingStoreException
-
getBackingStoreFactory
public BackingStoreFactory getBackingStoreFactory()
- Specified by:
getBackingStoreFactoryin classBackingStore<K extends Serializable,V extends Serializable>
-
load
public V load(K key, String version) throws BackingStoreException
Description copied from class:BackingStoreLoad and return the data for the given id. The store is expected to return the largest ever version that was saved in the stored using thesave()method.- Specified by:
loadin classBackingStore<K extends Serializable,V extends Serializable>- Parameters:
key- the key whose value must be returned- Returns:
- 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:
BackingStoreException- if the underlying store implementation encounters any exception
-
save
public String save(K key, V value, boolean isNew) throws BackingStoreException
Description copied from class:BackingStoreSave the value whose key is id. The store is NOT expected to throw an exception if isNew is false but the entry doesn't exist in the store. (This is possible in some implementations (like in-memory) where packets could be lost.)- Specified by:
savein classBackingStore<K extends Serializable,V extends Serializable>- Parameters:
key- the idvalue- The Metadata to be stored- Returns:
- A (possibly null) String indicating the instance name where the data was saved.
- Throws:
BackingStoreException- if the underlying store implementation encounters any exception
-
remove
public void remove(K key) throws BackingStoreException
Description copied from class:BackingStoreRemove the association for the id. After this call, any call toload(id)must return null. In addition, any association betweenidand container extra params must also be removed.- Specified by:
removein classBackingStore<K extends Serializable,V extends Serializable>- Parameters:
key- the id of the Metadata- Throws:
BackingStoreException- if the underlying store implementation encounters any exception
-
updateTimestamp
public String updateTimestamp(K key, String version, Long accessTime) throws BackingStoreException
Description copied from class:BackingStoreRecomended way is to just do a save(k, v)- Overrides:
updateTimestampin classBackingStore<K extends Serializable,V extends Serializable>- Throws:
BackingStoreException
-
removeExpired
public int removeExpired() throws BackingStoreExceptionDescription copied from class:BackingStoreRemove expired entries- Overrides:
removeExpiredin classBackingStore<K extends Serializable,V extends Serializable>- Throws:
BackingStoreException
-
size
public int size() throws BackingStoreExceptionDescription copied from class:BackingStoreGet the current size of the store- Specified by:
sizein classBackingStore<K extends Serializable,V extends Serializable>- Returns:
- the (approximate) number of entries in the store
- Throws:
BackingStoreException- if the underlying store implementation encounters any exception
-
destroy
public void destroy() throws BackingStoreExceptionDescription copied from class:BackingStoreCalled when the store is no longer needed. Must clean up and close any opened resources. The store must not be used after this call.- Overrides:
destroyin classBackingStore<K extends Serializable,V extends Serializable>- Throws:
BackingStoreException
-
-