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
Modifier and TypeMethodDescriptionvoiddestroy()Called when the store is no longer needed.protected voidinitialize(BackingStoreConfiguration<K, V> conf) Load and return the data for the given id.voidRemove the association for the id.intRemove expired entriesSave the value whose key is id.intsize()Get the current size of the storeupdateTimestamp(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 Details
-
initialize
- Overrides:
initializein classBackingStore<K extends Serializable,V extends Serializable> - Throws:
BackingStoreException
-
getBackingStoreFactory
- Specified by:
getBackingStoreFactoryin classBackingStore<K extends Serializable,V extends Serializable>
-
load
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
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
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
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
Description copied from class:BackingStoreRemove expired entries- Overrides:
removeExpiredin classBackingStore<K extends Serializable,V extends Serializable> - Throws:
BackingStoreException
-
size
Description 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
Description 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
-