public class MapStoreWrapper extends Object implements MapStore, MapLoaderLifecycleSupport
| Constructor and Description |
|---|
MapStoreWrapper(String mapName,
Object impl) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
instrument(NodeEngine nodeEngine) |
boolean |
isMapLoader() |
boolean |
isPostProcessingMapStore() |
Object |
load(Object key)
Loads the value of a given key.
|
Map |
loadAll(Collection keys)
Loads given keys.
|
Iterable<Object> |
loadAllKeys()
Returns an
Iterable of all keys or null
if a map loader is not configured for this map. |
void |
store(Object key,
Object value)
Stores the key-value pair.
|
void |
storeAll(Map map)
Stores multiple entries.
|
String |
toString() |
public MapStore getMapStore()
public void destroy()
MapLoaderLifecycleSupportdestroy in interface MapLoaderLifecycleSupportpublic void init(HazelcastInstance hazelcastInstance, Properties properties, String mapName)
MapLoaderLifecycleSupportMapLoader is configured, can be obtained from the
hazelcastInstance in this method's implementation.
On members joining a cluster, this method is executed during finalization
of the join operation, therefore care should be taken to adhere to the
rules for PostJoinAwareService.getPostJoinOperation().
If the implementation executes operations which may wait on locks or otherwise
block (e.g. waiting for network operations), this may result in a time-out and
obstruct the new member from joining the cluster. If blocking operations are
required for initialization of the MapLoader, consider deferring them
with a lazy initialization scheme.
init in interface MapLoaderLifecycleSupporthazelcastInstance - HazelcastInstance of this mapLoader.properties - Properties set for this mapStore. see MapStoreConfigmapName - name of the map.public boolean isMapLoader()
true if a MapLoader is configured for this mappublic void instrument(NodeEngine nodeEngine)
public void delete(Object key)
MapStoreIf an exception is thrown the remove operation will fail.
public void store(Object key, Object value)
MapStoreIf an exception is thrown then the put operation will fail.
public void storeAll(Map map)
MapStoreImplementation 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.
Note: on the retry phase only entries left in the map will be stored one-by-one. In this way a MapStore implementation can handle partial storeAll() cases when some entries were stored successfully before a failure happens. Entries removed from the map will be not passed to subsequent call to store() method any more.
public void deleteAll(Collection keys)
MapStoreIf an exception is thrown the entries will try to be deleted one by one using the delete() method.
Note: on the retry phase only entries left in the keys will be deleted one-by-one. In this way a MapStore implementation can handle partial deleteAll() cases when some entries were deleted successfully before a failure happens. Entries removed from the keys will be not passed to subsequent call to delete() method any more.
public Iterable<Object> loadAllKeys()
Iterable of all keys or null
if a map loader is not configured for this map.
Loads all of the keys from the store. The returned Iterable may return the keys lazily
by loading them in batches. The Iterator of this Iterable may implement the
Closeable interface in which case it will be closed once iteration is over.
This is intended for releasing resources such as closing a JDBC result set.
The returned Iterable should not contain any null keys.
loadAllKeys in interface MapLoadernull.public Object load(Object key)
MapLoaderpublic Map loadAll(Collection keys)
MapLoaderFor any key in the input keys, there should be a single mapping in the resulting map. Also the resulting map should not have any keys that are not part of the input keys.
The given collection should not contain any null keys.
The returned Map should not contain any null keys or values.
Loading other items than what provided in keys
prevents the map from being filled from the map store.
public Object getImpl()
public boolean isPostProcessingMapStore()
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.