|
GigaSpaces - Open Spaces | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openspaces.core.DefaultGigaMap
public class DefaultGigaMap
An implementation of the 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 Summary | |
|---|---|
DefaultGigaMap(com.j_spaces.map.IMap map,
TransactionProvider txProvider,
ExceptionTranslator exTranslator,
int defaultIsolationLevel)
Constructs a new DefaultGigaMap implementation. |
|
| Method Summary | |
|---|---|
void |
addListener(com.j_spaces.javax.cache.CacheListener cacheListener)
|
void |
clear()
|
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)
|
boolean |
containsValue(Object value)
|
Set |
entrySet()
|
boolean |
evict(Object key)
|
Object |
get(Object key)
|
Object |
get(Object key,
long waitForResponse)
Returns the object that is associated with key in this cache. |
Object |
get(Object key,
long waitForResponse,
int modifiers)
Returns the object that is associated with key in this cache. |
Map |
getAll(Collection keys)
|
com.j_spaces.javax.cache.CacheEntry |
getCacheEntry(Object key)
|
net.jini.core.transaction.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. |
com.j_spaces.map.IMap |
getMap()
Returns the IMap used 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()
|
boolean |
isLocked(Object key)
Returns true if the given key is locked. |
Set |
keySet()
|
void |
load(Object key)
|
void |
loadAll(Collection keys)
|
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)
|
Object |
put(Object key,
Object value)
|
Object |
put(Object key,
Object value,
LockHandle lockHandle)
Puts value to the cache with specified key. |
Object |
put(Object key,
Object value,
long timeToLive)
Puts value to the cache with specified key for
timeToLive milliseconds to live in the cache. |
Object |
put(Object key,
Object value,
long timeToLive,
LockHandle lockHandle)
Puts value to the cache with specified key for
timeToLive milliseconds to live in the cache. |
void |
putAll(Map t)
|
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)
|
Object |
remove(Object key,
long waitForResponse)
Removes the mapping for this key from this cache. |
Object |
remove(Object key,
long waitForResponse,
LockHandle lockHandle)
Removes the mapping for this key from this cache. |
void |
removeListener(com.j_spaces.javax.cache.CacheListener cacheListener)
|
void |
setDefaultLockTimeToLive(long defaultLockTimeToLive)
|
void |
setDefaultTimeToLive(long defaultTimeToLive)
|
void |
setDefaultWaitForResponse(long defaultWaitForResponse)
|
void |
setDefaultWaitingForLockTimeout(long defaultWaitingForLockTimeout)
|
int |
size()
|
String |
toString()
|
void |
unlock(Object key)
Unlocks the given lock on the key |
Collection |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.j_spaces.javax.cache.Cache |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public DefaultGigaMap(com.j_spaces.map.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
exception| Method Detail |
|---|
public void setDefaultWaitForResponse(long defaultWaitForResponse)
public void setDefaultTimeToLive(long defaultTimeToLive)
public void setDefaultLockTimeToLive(long defaultLockTimeToLive)
public void setDefaultWaitingForLockTimeout(long defaultWaitingForLockTimeout)
public com.j_spaces.map.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.
getMap in interface GigaMappublic TransactionProvider getTxProvider()
GigaMapIMap operations that requires explicit
transaction object.
getTxProvider in interface GigaMappublic int size()
size in interface com.j_spaces.javax.cache.Cachesize in interface Mappublic boolean isEmpty()
isEmpty in interface com.j_spaces.javax.cache.CacheisEmpty in interface Mappublic boolean containsKey(Object key)
containsKey in interface com.j_spaces.javax.cache.CachecontainsKey in interface Mappublic boolean containsValue(Object value)
containsValue in interface com.j_spaces.javax.cache.CachecontainsValue in interface Mappublic Object get(Object key)
get in interface com.j_spaces.javax.cache.Cacheget in interface Map
public Object get(Object key,
long waitForResponse)
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 response
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)
put in interface com.j_spaces.javax.cache.Cacheput in interface Map
public Object put(Object key,
Object value,
long timeToLive)
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 milliseconds
public Object put(Object key,
Object value,
LockHandle lockHandle)
GigaMapvalue to the cache with specified key.
put in interface GigaMapkey - key for the valuevalue - object(~ entry)lockHandle - If the key is locked, will perform the operation within the same lock
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 lock
public Object remove(Object key)
remove in interface com.j_spaces.javax.cache.Cacheremove in interface Map
public Object remove(Object key,
long waitForResponse)
GigaMapkey from this cache.
Client will wait at most waitForResponse milliseconds for
get call to return.
remove in interface GigaMapkey - key whose associated value is to be returned.waitForResponse - time to wait for response
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.
remove in interface GigaMapkey - key whose associated value is to be returned.waitForResponse - time to wait for responselockHandle - If the key is locked, will perform the operation within the same lock
public void putAll(Map t)
putAll in interface com.j_spaces.javax.cache.CacheputAll in interface Map
public void putAll(Map t,
long timeToLive)
GigaMap
putAll in interface GigaMapt - A map of key and values to be copy into the cachepublic void clear()
clear in interface com.j_spaces.javax.cache.Cacheclear in interface Mappublic void clear(boolean clearMaster)
GigaMap
clear in interface GigaMapclearMaster - if true clear also master, when false same as Map.clear().)public Set keySet()
keySet in interface com.j_spaces.javax.cache.CachekeySet in interface Mappublic Collection values()
values in interface com.j_spaces.javax.cache.Cachevalues in interface Mappublic Set entrySet()
entrySet in interface com.j_spaces.javax.cache.CacheentrySet in interface Mappublic void addListener(com.j_spaces.javax.cache.CacheListener cacheListener)
addListener in interface com.j_spaces.javax.cache.Cachepublic boolean evict(Object key)
evict in interface com.j_spaces.javax.cache.Cache
public Map getAll(Collection keys)
throws com.j_spaces.javax.cache.CacheException
getAll in interface com.j_spaces.javax.cache.Cachecom.j_spaces.javax.cache.CacheExceptionpublic com.j_spaces.javax.cache.CacheEntry getCacheEntry(Object key)
getCacheEntry in interface com.j_spaces.javax.cache.Cache
public void load(Object key)
throws com.j_spaces.javax.cache.CacheException
load in interface com.j_spaces.javax.cache.Cachecom.j_spaces.javax.cache.CacheException
public void loadAll(Collection keys)
throws com.j_spaces.javax.cache.CacheException
loadAll in interface com.j_spaces.javax.cache.Cachecom.j_spaces.javax.cache.CacheExceptionpublic Object peek(Object key)
peek in interface com.j_spaces.javax.cache.Cachepublic void removeListener(com.j_spaces.javax.cache.CacheListener cacheListener)
removeListener in interface com.j_spaces.javax.cache.Cachepublic net.jini.core.transaction.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.
lock in interface GigaMapkey - The key to lock
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).
lock in interface GigaMapkey - The key to locklockTimeToLive - The lock time to live (in milliseconds)waitingForLockTimeout - The time to wait for an already locked lock
public void unlock(Object key)
GigaMap
unlock in interface GigaMapkey - The key to unlockpublic boolean isLocked(Object key)
GigaMaptrue if the given key is locked. Otherwise returns false.
isLocked in interface GigaMapkey - The key to check if it locked or not.
true if the given key is locked or not.
public void putAndUnlock(Object key,
Object value)
GigaMap
putAndUnlock in interface GigaMapkey - The key to unlock and put the value invalue - The value to put after unlocking the keypublic long getDefaultTimeToLive()
GigaMap
getDefaultTimeToLive in interface GigaMappublic long getDefaultWaitForResponse()
GigaMap
getDefaultWaitForResponse in interface GigaMappublic int getModifiersForIsolationLevel()
TransactionDefinition.ISOLATION_DEFAULT will use the
default isolation level associated with this class (which is REPEATABLE_READ).
public String toString()
toString in class Object
|
GigaSpaces - Open Spaces | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||