org.glassfish.ha.store.impl
Class NoOpBackingStore<K extends java.io.Serializable,V extends java.io.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 java.io.Serializable,V extends java.io.Serializable>
extends BackingStore<K,V>

Author:
Mahesh Kannan

Method Summary
 void destroy()
          Called when the store is no longer needed.
protected  void initialize(BackingStoreConfiguration<K,V> conf)
           
 V load(K key, java.lang.Long version)
           
 V load(java.lang.Object key, java.lang.String version)
          Load and return the data for the given id.
 void remove(K key)
          Remove the association for the id.
 int removeExpired(long idleForMillis)
          Remove expired entries
 java.lang.String save(K key, V value, boolean isNew)
          Save the value whose key is id.
 int size()
          Get the current size of the store
 void updateTimestamp(K key, long time)
           
 java.lang.String updateTimestamp(K key, java.lang.Long version, java.lang.Long accessTime, java.lang.Long maxIdleTime)
          Recomended way is to just do a save(k, v)
 
Methods inherited from class org.glassfish.ha.store.api.BackingStore
close, createObjectInputStream, createObjectOutputStream, findByCriteria, getBackingStoreConfiguration, getBackingStoreFactory, removeByCriteria, removeExpired, synchronizeKeys
 
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 java.io.Serializable,V extends java.io.Serializable>
Throws:
BackingStoreException

load

public V load(java.lang.Object key,
              java.lang.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 java.io.Serializable,V extends java.io.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

load

public V load(K key,
              java.lang.Long version)
                                    throws BackingStoreException
Throws:
BackingStoreException

save

public java.lang.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 java.io.Serializable,V extends java.io.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 java.io.Serializable,V extends java.io.Serializable>
Parameters:
key - the id of the Metadata
Throws:
BackingStoreException - if the underlying store implementation encounters any exception

updateTimestamp

public void updateTimestamp(K key,
                            long time)
                     throws BackingStoreException
Specified by:
updateTimestamp in class BackingStore<K extends java.io.Serializable,V extends java.io.Serializable>
Throws:
BackingStoreException

updateTimestamp

public java.lang.String updateTimestamp(K key,
                                        java.lang.Long version,
                                        java.lang.Long accessTime,
                                        java.lang.Long maxIdleTime)
                                 throws BackingStoreException
Description copied from class: BackingStore
Recomended way is to just do a save(k, v)

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

removeExpired

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

Specified by:
removeExpired in class BackingStore<K extends java.io.Serializable,V extends java.io.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 java.io.Serializable,V extends java.io.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.

Specified by:
destroy in class BackingStore<K extends java.io.Serializable,V extends java.io.Serializable>
Throws:
BackingStoreException


Copyright © 2010. All Rights Reserved.