com.hazelcast.map.impl
Class MapStoreWrapper

java.lang.Object
  extended by com.hazelcast.map.impl.MapStoreWrapper
All Implemented Interfaces:
MapLoader, MapLoaderLifecycleSupport, MapStore

public class MapStoreWrapper
extends Object
implements MapStore, MapLoaderLifecycleSupport


Constructor Summary
MapStoreWrapper(String mapName, Object impl)
           
 
Method Summary
 void delete(Object key)
          Deletes the entry with a given key from the store.
 void deleteAll(Collection keys)
          Deletes multiple entries from the store.
 void destroy()
          Hazelcast will call this method before shutting down.
 Object getImpl()
           
 MapStore getMapStore()
           
 void init(HazelcastInstance hazelcastInstance, Properties properties, String mapName)
          Initializes this MapLoader implementation.
 boolean isPostProcessingMapStore()
           
 Object load(Object key)
          Loads the value of a given key.
 Map loadAll(Collection keys)
          Loads given keys.
 Set loadAllKeys()
          Loads all of the keys from the store.
 void store(Object key, Object value)
          Stores the key-value pair.
 void storeAll(Map map)
          Stores multiple entries.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapStoreWrapper

public MapStoreWrapper(String mapName,
                       Object impl)
Method Detail

getMapStore

public MapStore getMapStore()

destroy

public void destroy()
Description copied from interface: MapLoaderLifecycleSupport
Hazelcast will call this method before shutting down. This method can be overridden to clean up the resources held by this map loader implementation, such as closing the database connections, etc.

Specified by:
destroy in interface MapLoaderLifecycleSupport

init

public void init(HazelcastInstance hazelcastInstance,
                 Properties properties,
                 String mapName)
Description copied from interface: MapLoaderLifecycleSupport
Initializes this MapLoader implementation. Hazelcast will call this method when the map is first used on the HazelcastInstance. Implementation can initialize required resources for the implementing mapLoader, such as reading a config file and/or creating a database connection.

Specified by:
init in interface MapLoaderLifecycleSupport
Parameters:
hazelcastInstance - HazelcastInstance of this mapLoader.
properties - Properties set for this mapStore. see MapStoreConfig
mapName - name of the map.

delete

public void delete(Object key)
Description copied from interface: MapStore
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
Parameters:
key - the key to delete from the store.

store

public void store(Object key,
                  Object value)
Description copied from interface: MapStore
Stores the key-value pair. If an exception is thrown then the put operation will fail.

Specified by:
store in interface MapStore
Parameters:
key - key of the entry to store
value - value of the entry to store

storeAll

public void storeAll(Map map)
Description copied from interface: MapStore
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
Parameters:
map - map of entries to store

deleteAll

public void deleteAll(Collection keys)
Description copied from interface: MapStore
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
Parameters:
keys - the keys of the entries to delete.

loadAllKeys

public Set loadAllKeys()
Description copied from interface: MapLoader
Loads all of the keys from the store.

Specified by:
loadAllKeys in interface MapLoader
Returns:
all the keys

load

public Object load(Object key)
Description copied from interface: MapLoader
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
Returns:
value of the key

loadAll

public Map loadAll(Collection keys)
Description copied from interface: MapLoader
Loads given keys. This is batch load operation so that implementation can optimize the multiple loads.

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

getImpl

public Object getImpl()

isPostProcessingMapStore

public boolean isPostProcessingMapStore()

toString

public String toString()
Overrides:
toString in class Object


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