com.hazelcast.core
Class MapStoreAdapter<K,V>

java.lang.Object
  extended by com.hazelcast.core.MapStoreAdapter<K,V>
Type Parameters:
K - key of the map entry
V - value of the map entry.
All Implemented Interfaces:
MapLoader<K,V>, MapStore<K,V>

public class MapStoreAdapter<K,V>
extends Object
implements MapStore<K,V>

Adapter for MapStore.

See Also:
MapStore

Constructor Summary
MapStoreAdapter()
           
 
Method Summary
 void delete(K key)
          Deletes the entry with a given key from the store.
 void deleteAll(Collection<K> keys)
          Deletes multiple entries from the store.
 V load(K key)
          Loads the value of a given key.
 Map<K,V> loadAll(Collection<K> keys)
          Loads given keys.
 Set<K> loadAllKeys()
          Loads all of the keys from the store.
 void store(K key, V value)
          Stores the key-value pair.
 void storeAll(Map<K,V> map)
          Stores multiple entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapStoreAdapter

public MapStoreAdapter()
Method Detail

delete

public void delete(K key)
Deletes the entry with a given key from the store. If an exception is thrown the remove operation will fail.

Specified by:
delete in interface MapStore<K,V>
Parameters:
key - the key to delete from the store.

store

public void store(K key,
                  V value)
Stores the key-value pair. If an exception is thrown then the put operation will fail.

Specified by:
store in interface MapStore<K,V>
Parameters:
key - key of the entry to store
value - value of the entry to store

storeAll

public void storeAll(Map<K,V> map)
Stores multiple entries. Implementation of this method can optimize the store operation by storing all entries in one database connection. storeAll is used when writeDelaySeconds is positive (write-behind). If an exception is thrown, the entries will try to be stored one by one using the store() method.

Specified by:
storeAll in interface MapStore<K,V>
Parameters:
map - map of entries to store

deleteAll

public void deleteAll(Collection<K> keys)
Deletes multiple entries from the store. If an exception is thrown the entries will try to be deleted one by one using the delete() method.

Specified by:
deleteAll in interface MapStore<K,V>
Parameters:
keys - the keys of the entries to delete.

load

public V load(K key)
Loads the value of a given key. If distributed map doesn't contain the value for the given key then Hazelcast will call implementation's load (key) method to obtain the value. Implementation can use any means of loading the given key; such as an O/R mapping tool, simple SQL or reading a file etc.

Specified by:
load in interface MapLoader<K,V>
Returns:
value of the key

loadAll

public Map<K,V> loadAll(Collection<K> keys)
Loads given keys. This is batch load operation so that implementation can optimize the multiple loads.

Specified by:
loadAll in interface MapLoader<K,V>
Parameters:
keys - keys of the values entries to load
Returns:
map of loaded key-value pairs.

loadAllKeys

public Set<K> loadAllKeys()
Loads all of the keys from the store.

Specified by:
loadAllKeys in interface MapLoader<K,V>
Returns:
all the keys


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.