Skip navigation links
com.tangosol.net.cache
Class ReadonlyNamedCache
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.AbstractKeyBasedMap
com.tangosol.util.AbstractKeySetBasedMap
com.tangosol.util.WrapperObservableMap
com.tangosol.util.WrapperConcurrentMap
com.tangosol.net.cache.WrapperNamedCache
com.tangosol.net.cache.ReadonlyNamedCache
- All Implemented Interfaces:
- CacheMap, NamedCache, ConcurrentMap, InvocableMap, ObservableMap, QueryMap, Map
-
public class ReadonlyNamedCache
- extends WrapperNamedCache
A simple extension of the WrapperNamedCache implementation that shields all content mutating operations such as put(), remove(), lock() etc.
- Author:
- gg 2006.08.06
Field Summary |
protected boolean |
m_fStrict
Specifies whether or not the "read-only" nature of this NamedCache is strictly enforced. |
Methods inherited from class com.tangosol.net.cache.WrapperNamedCache |
addIndex, aggregate, aggregate, entrySet, entrySet, getAll, getCacheName, getCacheService, isActive, keySet, put, release, removeIndex |
Methods inherited from class com.tangosol.util.WrapperObservableMap |
addMapListener, addMapListener, addMapListener, containsValue, dispatchEvent, dispatchPendingEvent, ensureInternalListener, ensureMapListenerSupport, get, getCacheStatistics, getInternalKeySet, getMap, getMapListenerSupport, hasListeners, instantiateInternalListener, isCollectStats, isEventFabricator, isSynthetic, isTranslateEvents, removeMapListener, removeMapListener, removeMapListener, setCollectStats, setTranslateEvents |
m_fStrict
protected boolean m_fStrict
- Specifies whether or not the "read-only" nature of this NamedCache is strictly enforced.
ReadonlyNamedCache
public ReadonlyNamedCache(NamedCache cache,
boolean fStrict)
- Construct a NamedCache wrapper based on the specified map.
- Parameters:
cache
- the NamedCache object that will be wrapped by this read-only wrapper
fStrict
- if true, calls to mutating opearations will throw the UnsupportedOpearionException; otherwise those calls will have no effect whatsoever
ReadonlyNamedCache
public ReadonlyNamedCache(Map map,
String sName,
boolean fStrict)
- Construct a NamedCache wrapper based on the specified map.
- Parameters:
map
- the Map that will be wrapped by this read-only wrapper
sName
- the cache name
fStrict
- if true, calls to mutating opearations will throw the UnsupportedOpearionException; otherwise those calls will have no effect whatsoever
destroy
public void destroy()
- Should not be called.
-
- Specified by:
destroy
in interface NamedCache
- Overrides:
destroy
in class WrapperNamedCache
-
- See Also:
CacheFactory.destroyCache(NamedCache)
, ConfigurableCacheFactory.destroyCache(NamedCache)
invoke
public Object invoke(Object oKey,
InvocableMap.EntryProcessor agent)
- Should not be called.
-
- Specified by:
invoke
in interface InvocableMap
- Overrides:
invoke
in class WrapperNamedCache
-
- Parameters:
oKey
- the key to process; it is not required to exist within the Map
agent
- the EntryProcessor to use to process the specified key
- Returns:
- the result of the invocation as returned from the EntryProcessor
invokeAll
public Map invokeAll(Collection collKeys,
InvocableMap.EntryProcessor agent)
- Should not be called.
-
- Specified by:
invokeAll
in interface InvocableMap
- Overrides:
invokeAll
in class WrapperNamedCache
-
- Parameters:
collKeys
- the keys to process; these keys are not required to exist within the Map
agent
- the EntryProcessor to use to process the specified keys
- Returns:
- a Map containing the results of invoking the EntryProcessor against each of the specified keys
invokeAll
public Map invokeAll(Filter filter,
InvocableMap.EntryProcessor agent)
- Should not be called.
-
- Specified by:
invokeAll
in interface InvocableMap
- Overrides:
invokeAll
in class WrapperNamedCache
-
- Parameters:
filter
- a Filter that results in the set of keys to be processed
agent
- the EntryProcessor to use to process the specified keys
- Returns:
- a Map containing the results of invoking the EntryProcessor against the keys that are selected by the given Filter
put
public Object put(Object oKey,
Object oValue)
- Should not be called.
-
- Specified by:
put
in interface CacheMap
- Specified by:
put
in interface ConcurrentMap
- Specified by:
put
in interface Map
- Overrides:
put
in class WrapperConcurrentMap
-
- Parameters:
oKey
- key with which the specified value is to be associated
oValue
- value to be associated with the specified key
- Returns:
- previous value associated with specified key, or null if there was no mapping for key
putAll
public void putAll(Map map)
- Should not be called.
-
- Specified by:
putAll
in interface ConcurrentMap
- Specified by:
putAll
in interface Map
- Overrides:
putAll
in class WrapperConcurrentMap
-
- Parameters:
map
- the Map containing the key/value pairings to put into this Map
remove
public Object remove(Object oKey)
- Should not be called.
-
- Specified by:
remove
in interface ConcurrentMap
- Specified by:
remove
in interface Map
- Overrides:
remove
in class WrapperConcurrentMap
-
- Parameters:
oKey
- key whose mapping is to be removed from the map
- Returns:
- previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values.
clear
public void clear()
- Should not be called.
-
- Specified by:
clear
in interface ConcurrentMap
- Specified by:
clear
in interface Map
- Overrides:
clear
in class WrapperConcurrentMap
lock
public boolean lock(Object oKey,
long cWait)
- Should not be called.
-
- Specified by:
lock
in interface ConcurrentMap
- Overrides:
lock
in class WrapperConcurrentMap
-
- Parameters:
oKey
- key being locked
cWait
- the number of milliseconds to continue trying to obtain a lock; pass zero to return immediately; pass -1 to block the calling thread until the lock could be obtained
- Returns:
- true if the item was successfully locked within the specified time; false otherwise
lock
public boolean lock(Object oKey)
- Should not be called.
-
- Specified by:
lock
in interface ConcurrentMap
- Overrides:
lock
in class WrapperConcurrentMap
-
- Parameters:
oKey
- key being locked
- Returns:
- true if the item was successfully locked; false otherwise
unlock
public boolean unlock(Object oKey)
- Should not be called.
-
- Specified by:
unlock
in interface ConcurrentMap
- Overrides:
unlock
in class WrapperConcurrentMap
-
- Parameters:
oKey
- key being unlocked
- Returns:
- true if the item was successfully unlocked; false otherwise
removeBlind
protected boolean removeBlind(Object oKey)
- Should not be called.
-
- Overrides:
removeBlind
in class WrapperConcurrentMap
-
- Parameters:
oKey
- key whose mapping is to be removed from the map
- Returns:
- true iff the Map changed as the result of this operation
checkStrict
protected void checkStrict()
- Enforce the "strict" read-only policy.
Skip navigation links
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.