org.glassfish.ha.store.impl
Class NoOpBackingStore<K extends Serializable,V extends Serializable>

java.lang.Object
  extended by org.glassfish.ha.store.api.BackingStore<K,V>
      extended by 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
 void destroy()
          Called when the store is no longer needed.
 BackingStoreFactory getBackingStoreFactory()
           
protected  void initialize(BackingStoreConfiguration<K,V> conf)
           
 V load(K key, String version)
          Load and return the data for the given id.
 void remove(K key)
          Remove the association for the id.
 int removeExpired()
          Remove expired entries
 String save(K key, V value, boolean isNew)
          Save the value whose key is id.
 int size()
          Get the current size of the store
 String updateTimestamp(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

protected void initialize(BackingStoreConfiguration<K,V> conf)
                   throws BackingStoreException
Overrides:
initialize in class BackingStore<K extends Serializable,V extends Serializable>
Throws:
BackingStoreException

getBackingStoreFactory

public BackingStoreFactory getBackingStoreFactory()
Specified by:
getBackingStoreFactory in class BackingStore<K extends Serializable,V extends Serializable>

load

public V load(K key,
              String version)
                            throws BackingStoreException
Description copied from class: BackingStore
Load 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 the save() method.

Specified by:
load in class BackingStore<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: BackingStore
Save 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:
save in class BackingStore<K extends Serializable,V extends Serializable>
Parameters:
key - the id
value - 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: BackingStore
Remove the association for the id.

After this call, any call to load(id) must return null. In addition, any association between id and container extra params must also be removed.

Specified by:
remove in class BackingStore<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: BackingStore
Recomended way is to just do a save(k, v)

Overrides:
updateTimestamp in class BackingStore<K extends Serializable,V extends Serializable>
Throws:
BackingStoreException

removeExpired

public int removeExpired()
                  throws BackingStoreException
Description copied from class: BackingStore
Remove expired entries

Overrides:
removeExpired in class BackingStore<K extends Serializable,V extends Serializable>
Throws:
BackingStoreException

size

public int size()
         throws BackingStoreException
Description copied from class: BackingStore
Get the current size of the store

Specified by:
size in class BackingStore<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 BackingStoreException
Description copied from class: BackingStore
Called 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:
destroy in class BackingStore<K extends Serializable,V extends Serializable>
Throws:
BackingStoreException


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.