public class DefaultGigaMap extends Object implements GigaMap
GigaMap interface simplifying the work with JCache and Map
 interface on top of the Space.
 Provides declarative transactions support (for methods that are by nature transactional, such
 as get and put) and the ability to set defaults for both
 timeToLive and waitForResponse.
 
Will also automatically apply the current running transaction isolation level when performing read operations (that in turn are translated into the Space).
| Constructor and Description | 
|---|
| DefaultGigaMap(IMap map,
              TransactionProvider txProvider,
              ExceptionTranslator exTranslator,
              int defaultIsolationLevel)Constructs a new DefaultGigaMap implementation. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addListener(CacheListener cacheListener)Add a listener to the list of cache listeners. Optional, not supported by all the implementations, currently supported only by local cache. | 
| void | clear()The clear method will remove all objects from the cache including the key and the associated
 value. | 
| void | clear(boolean clearMaster)The clear method will remove all objects from the cache including the key and the associated
 value. | 
| boolean | containsKey(Object key)Returns true if the cache contains the specified key. | 
| boolean | containsValue(Object value)Returns true if this cache maps one or more keys to the specified value. | 
| Set | entrySet()Returns a set view of the objects currently contained in the cache. | 
| boolean | evict(Object key)The evict method will remove object from the cache the matches the provided key. | 
| Object | get(Object key)The get method will return, from the cache, the object associated with the argument "key". | 
| Object | get(Object key,
   long waitForResponse)Returns the object that is associated with  keyin this cache. | 
| Object | get(Object key,
   long waitForResponse,
   int modifiers)Returns the object that is associated with  keyin this cache. | 
| Map | getAll(Collection keys)The getAll method will return, from the cache, a Map of the objects associated with the
 Collection of keys in argument "keys". | 
| CacheEntry | getCacheEntry(Object key)Returns the CacheEntry object associated with the object identified by "key". | 
| Transaction | getCurrentTransaction()Returns the current running transaction. | 
| long | getDefaultTimeToLive()Returns the default time to live of entries in the map. | 
| long | getDefaultWaitForResponse()Returns the default wait for response value for entries in the map. | 
| IMap | getMap()Returns the  IMapused by this GigaMap implementation to delegate different space
 operations. | 
| int | getModifiersForIsolationLevel()Gets the isolation level from the current running transaction (enabling the usage of Spring
 declarative isolation level settings). | 
| TransactionProvider | getTxProvider()Returns the transaction provider allowing accessing the current running transaction. | 
| boolean | isEmpty()Return true if entrySet().isEmpty() return true. | 
| boolean | isLocked(Object key)Returns  trueif the given key is locked. | 
| Set | keySet()Returns a set view of the keys currently contained in the cache. | 
| void | load(Object key)The load method provides a means to "pre load" the cache. | 
| void | loadAll(Collection keys)The loadAll method provides a means to "pre load" objects into the cache. | 
| LockHandle | lock(Object key)Locks the given key for any updates. | 
| LockHandle | lock(Object key,
    long lockTimeToLive,
    long waitingForLockTimeout)Locks the given key for any updates. | 
| Object | peek(Object key)The peek method will return the object associated with "key" if it currently exists (and is
 valid) in the cache. | 
| Object | put(Object key,
   Object value)The put method adds the object "value" to the cache identified by the object "key". | 
| Object | put(Object key,
   Object value,
   LockHandle lockHandle)Puts  valueto the cache with specifiedkey. | 
| Object | put(Object key,
   Object value,
   long timeToLive)Puts  valueto the cache with specifiedkeyfortimeToLivemilliseconds to live in the cache. | 
| Object | put(Object key,
   Object value,
   long timeToLive,
   LockHandle lockHandle)Puts  valueto the cache with specifiedkeyfortimeToLivemilliseconds to live in the cache. | 
| Object | put(Object key,
   Object value,
   long timeToLive,
   long timeout)Puts  valueto the cache with specifiedkeyfortimeToLivemilliseconds to live in the cache. | 
| void | putAll(Map t)Copies all of the mappings from the specified map to the cache. | 
| void | putAll(Map t,
      long timeToLive)Copies all of the mappings from the specified map to the cache. | 
| void | putAndUnlock(Object key,
            Object value)Unlocks the given key and puts the given value in a single operation. | 
| Object | remove(Object key)The remove method will delete the object from the cache including the key, the associated
 value and the associated CacheStatistics object. | 
| Object | remove(Object key,
      long waitForResponse)Removes the mapping for this  keyfrom this cache. | 
| Object | remove(Object key,
      long waitForResponse,
      LockHandle lockHandle)Removes the mapping for this  keyfrom this cache. | 
| void | removeListener(CacheListener cacheListener)Remove a listener from the list of cache listeners. Optional, not supported by all the implementations, currently supported only by local cache | 
| void | setDefaultLockTimeToLive(long defaultLockTimeToLive) | 
| void | setDefaultTimeToLive(long defaultTimeToLive) | 
| void | setDefaultWaitForResponse(long defaultWaitForResponse) | 
| void | setDefaultWaitingForLockTimeout(long defaultWaitingForLockTimeout) | 
| int | size()Returns the size of this map. | 
| String | toString() | 
| void | unlock(Object key)Unlocks the given lock on the key | 
| Collection | values()Returns a collection view of the values contained in this cache. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic DefaultGigaMap(IMap map, TransactionProvider txProvider, ExceptionTranslator exTranslator, int defaultIsolationLevel)
map - The map implementation to delegate operations totxProvider - The transaction provider for declarative transaction ex.exTranslator - Exception translator to translate low level exceptions into GigaSpaces
                     runtime exceptionpublic void setDefaultWaitForResponse(long defaultWaitForResponse)
public void setDefaultTimeToLive(long defaultTimeToLive)
public void setDefaultLockTimeToLive(long defaultLockTimeToLive)
public void setDefaultWaitingForLockTimeout(long defaultWaitingForLockTimeout)
public IMap getMap()
GigaMapIMap used by this GigaMap implementation to delegate different space
 operations.
 Allows to execute map operations that are not exposed by this interface, as well as using it as a parameter to other low level GigaSpace components.
If a transaction object is required for low level operations (as low level operations do
 not have declarative transaction ex) the GigaMap.getTxProvider() should be used to acquire
 the current running transaction.
public TransactionProvider getTxProvider()
GigaMapIMap operations that requires explicit transaction object.getTxProvider in interface GigaMappublic int size()
Cachepublic boolean isEmpty()
Cachepublic boolean containsKey(Object key)
CachecontainsKey in interface CachecontainsKey in interface Mapkey - key whose presence in this cache is to be tested.true, if the cache contains the specified key.public boolean containsValue(Object value)
CachecontainsValue in interface CachecontainsValue in interface Mapvalue - value whose presence in this cache is to be tested.true, if the cache contains the specified value.public Object get(Object key)
Cachepublic Object get(Object key, long waitForResponse)
GigaMapkey in this cache. Client will wait
 at most waitForResponse milliseconds for get call to return.public Object get(Object key, long waitForResponse, int modifiers)
GigaMapkey in this cache. Client will wait
 at most waitForResponse milliseconds for get call to return.get in interface GigaMapkey - key whose associated value is to be returned.waitForResponse - time to wait for responsemodifiers - one or a union of ReadModifiers.public Object put(Object key, Object value)
Cachepublic Object put(Object key, Object value, long timeToLive)
GigaMapvalue to the cache with specified key for
 timeToLive milliseconds to live in the cache.public Object put(Object key, Object value, long timeToLive, long timeout)
GigaMapvalue to the cache with specified key for
 timeToLive milliseconds to live in the cache.put in interface GigaMapkey - key for the valuevalue - object(~ entry)timeToLive - time to keep object in this cache, in millisecondstimeout - A timeout to use if the object is locked under a transaction (in
                   milliseconds)public Object put(Object key, Object value, LockHandle lockHandle)
GigaMapvalue to the cache with specified key.public Object put(Object key, Object value, long timeToLive, LockHandle lockHandle)
GigaMapvalue to the cache with specified key for
 timeToLive milliseconds to live in the cache.put in interface GigaMapkey - key for the valuevalue - object(~ entry)timeToLive - time to keep object in this cache, in millisecondslockHandle - If the key is locked, will perform the operation within the same lockpublic Object remove(Object key)
Cachepublic Object remove(Object key, long waitForResponse)
GigaMapkey from this cache. Client will wait at most
 waitForResponse milliseconds for get call to return.public Object remove(Object key, long waitForResponse, LockHandle lockHandle)
GigaMapkey from this cache. Client will wait at most
 waitForResponse milliseconds for get call to return.public void putAll(Map t)
Cachepublic void putAll(Map t, long timeToLive)
GigaMappublic void clear()
Cachepublic void clear(boolean clearMaster)
GigaMapclear in interface GigaMapclearMaster - if true clear also master, when false same as
                    Map.clear().)public Set keySet()
Cachepublic Collection values()
Cachepublic Set entrySet()
Cachepublic void addListener(CacheListener cacheListener)
CacheaddListener in interface CachecacheListener - call back CacheListenerpublic boolean evict(Object key)
Cachepublic Map getAll(Collection keys) throws CacheException
CachegetAll in interface Cachekeys - keys whose associated values are to be returned.CacheException - error accord while loadingpublic CacheEntry getCacheEntry(Object key)
CachegetCacheEntry in interface Cachekey - key whose associated value is to be returned.public void load(Object key) throws CacheException
Cacheload in interface Cachekey - key whose associated value is to be loaded.CacheException - error accord while loadingpublic void loadAll(Collection keys) throws CacheException
CacheloadAll in interface Cachekeys - keys' Collection whose associated value to be loaded using the associated
             CacheLoader if this cache doesn't contain it.CacheException - error accord while loadingpublic Object peek(Object key)
Cachepublic void removeListener(CacheListener cacheListener)
CacheremoveListener in interface CachecacheListener - the CacheListener to removepublic Transaction getCurrentTransaction()
GigaMapnull if no transaction is in
 progress.getCurrentTransaction in interface GigaMappublic LockHandle lock(Object key)
GigaMapLockHandle
 that can be bused to perform specific updates under the same lock (by calling GigaMap.put(Object, Object, org.openspaces.core.map.LockHandle) for example).
 Will use the configured default lock time to live and default waiting for lock timeout values. By default the lock time to live is 60 seconds and waiting for lock timeout is 10 seconds.
public LockHandle lock(Object key, long lockTimeToLive, long waitingForLockTimeout)
GigaMapLockHandle
 that can be used to perform specific updates under the same lock (by using the transaction
 object stored within it).public void unlock(Object key)
GigaMappublic boolean isLocked(Object key)
GigaMaptrue if the given key is locked. Otherwise returns false.public void putAndUnlock(Object key, Object value)
GigaMapputAndUnlock in interface GigaMapkey - The key to unlock and put the value invalue - The value to put after unlocking the keypublic long getDefaultTimeToLive()
GigaMapgetDefaultTimeToLive in interface GigaMappublic long getDefaultWaitForResponse()
GigaMapgetDefaultWaitForResponse in interface GigaMappublic int getModifiersForIsolationLevel()
TransactionDefinition.ISOLATION_DEFAULT
 will use the default isolation level associated with this class (which is
 REPEATABLE_READ).Copyright © GigaSpaces.