Package com.tangosol.net.cache
Class ReadonlyNamedCache<K,V>
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.AbstractKeyBasedMap<K,V>
com.tangosol.util.AbstractKeySetBasedMap<K,V>
com.tangosol.util.WrapperObservableMap<K,V>
com.tangosol.util.WrapperConcurrentMap<K,V>
com.tangosol.net.cache.WrapperNamedCache<K,V>
com.tangosol.net.cache.ReadonlyNamedCache<K,V>
- Type Parameters:
K
- the type of the cache entry keysV
- the type of the cache entry values
- All Implemented Interfaces:
CacheMap<K,
,V> NamedCache<K,
,V> NamedCollection
,NamedMap<K,
,V> Releasable
,ConcurrentMap<K,
,V> InvocableMap<K,
,V> ObservableMap<K,
,V> QueryMap<K,
,V> AutoCloseable
,Map<K,
V>
A simple extension of the WrapperNamedCache implementation that shields all
content mutating operations such as put(), remove(), lock() etc.
- Author:
- gg 2006.08.06
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.WrapperConcurrentMap
WrapperConcurrentMap.Lock
Nested classes/interfaces inherited from class com.tangosol.util.WrapperObservableMap
WrapperObservableMap.InternalListener
Nested classes/interfaces inherited from class com.tangosol.util.AbstractKeySetBasedMap
AbstractKeySetBasedMap.EntrySet, AbstractKeySetBasedMap.KeyIterator, AbstractKeySetBasedMap.KeySet, AbstractKeySetBasedMap.ValuesCollection
Nested classes/interfaces inherited from class com.tangosol.util.AbstractKeyBasedMap
AbstractKeyBasedMap.DeferredCacheEvent<K,
V> Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
Nested classes/interfaces inherited from interface com.tangosol.util.InvocableMap
InvocableMap.Entry<K,
V>, InvocableMap.EntryAggregator<K, V, R>, InvocableMap.EntryProcessor<K, V, R>, InvocableMap.ParallelAwareAggregator<K, V, P, R>, InvocableMap.StreamingAggregator<K, V, P, R> Nested classes/interfaces inherited from interface com.tangosol.net.NamedMap
NamedMap.Option
Nested classes/interfaces inherited from interface com.tangosol.util.QueryMap
QueryMap.Entry<K,
V> -
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Specifies whether or not the "read-only" nature of this NamedCache is strictly enforced.Fields inherited from class com.tangosol.net.cache.WrapperNamedCache
m_service, m_sName
Fields inherited from class com.tangosol.util.WrapperConcurrentMap
m_cWaitMillis, m_fEnforceLocking, m_gateMap, m_mapLock
Fields inherited from class com.tangosol.util.WrapperObservableMap
m_fDeferredEvent, m_fTranslateEvents, m_listenerInternal, m_listenerSupport, m_map, m_stats
Fields inherited from class com.tangosol.util.Base
LOG_ALWAYS, LOG_CONFIG, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
Fields inherited from interface com.tangosol.net.cache.CacheMap
EXPIRY_DEFAULT, EXPIRY_NEVER
Fields inherited from interface com.tangosol.util.ConcurrentMap
LOCK_ALL
-
Constructor Summary
ConstructorDescriptionReadonlyNamedCache
(NamedCache<K, V> cache, boolean fStrict) Construct a NamedCache wrapper based on the specified map.ReadonlyNamedCache
(Map<K, V> map, String sName, boolean fStrict) Construct a NamedCache wrapper based on the specified map. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Enforce the "strict" read-only policy.void
clear()
Should not be called.void
destroy()
Should not be called.<R> R
invoke
(K key, InvocableMap.EntryProcessor<K, V, R> agent) Should not be called.invokeAll
(Filter filter, InvocableMap.EntryProcessor<K, V, R> agent) Should not be called.invokeAll
(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K, V, R> agent) Should not be called.boolean
Should not be called.boolean
Should not be called.Should not be called.void
Should not be called.Should not be called.protected boolean
removeBlind
(Object oKey) Should not be called.void
truncate()
Should not be called.boolean
Should not be called.Methods inherited from class com.tangosol.net.cache.WrapperNamedCache
addIndex, aggregate, aggregate, entrySet, entrySet, getAll, getCacheName, getCacheService, isActive, isDestroyed, isReady, isReleased, keySet, put, release, removeIndex
Methods inherited from class com.tangosol.util.WrapperConcurrentMap
getDescription, getLockDescription, getWaitMillis, instantiateLock, isInternalKeySetIteratorMutable, isLockingEnforced, setLockingEnforced, setWaitMillis, toString
Methods inherited from class com.tangosol.util.WrapperObservableMap
addMapListener, addMapListener, addMapListener, containsValue, dispatchEvent, dispatchPendingEvent, ensureInternalListener, ensureMapListenerSupport, equals, get, getCacheStatistics, getInternalKeySet, getMap, getMapListenerSupport, hashCode, hasListeners, instantiateInternalListener, isCollectStats, isEventFabricator, isSynthetic, isTranslateEvents, removeMapListener, removeMapListener, removeMapListener, setCollectStats, setTranslateEvents
Methods inherited from class com.tangosol.util.AbstractKeySetBasedMap
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateKeySet, instantiateValues, isEmpty, iterateKeys, size
Methods inherited from class com.tangosol.util.AbstractKeyBasedMap
clone, entrySet, keySet, values
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.tangosol.util.ConcurrentMap
containsKey, containsValue, get, isEmpty, size
Methods inherited from interface com.tangosol.util.InvocableMap
aggregate, compute, compute, computeIfAbsent, computeIfAbsent, computeIfPresent, computeIfPresent, getOrDefault, invokeAll, merge, merge, putIfAbsent, remove, replace, replace, replaceAll, replaceAll, replaceAll, replaceAll, stream, stream, stream, stream, stream, stream
Methods inherited from interface com.tangosol.net.NamedMap
getName, getService
Methods inherited from interface com.tangosol.util.ObservableMap
addMapListener, addMapListener, addMapListener, removeMapListener, removeMapListener, removeMapListener
Methods inherited from interface com.tangosol.util.QueryMap
addIndex, forEach, forEach, values, values
Methods inherited from interface com.tangosol.net.Releasable
close
-
Field Details
-
m_fStrict
protected boolean m_fStrictSpecifies whether or not the "read-only" nature of this NamedCache is strictly enforced.
-
-
Constructor Details
-
ReadonlyNamedCache
Construct a NamedCache wrapper based on the specified map.- Parameters:
cache
- the NamedCache object that will be wrapped by this read-only wrapperfStrict
- if true, calls to mutating operations will throw the UnsupportedOperationException; otherwise those calls will have no effect whatsoever
-
ReadonlyNamedCache
Construct a NamedCache wrapper based on the specified map.- Parameters:
map
- the Map that will be wrapped by this read-only wrappersName
- the cache namefStrict
- if true, calls to mutating operations will throw the UnsupportedOperationException; otherwise those calls will have no effect whatsoever
-
-
Method Details
-
destroy
public void destroy()Should not be called.- Specified by:
destroy
in interfaceNamedCollection
- Overrides:
destroy
in classWrapperNamedCache<K,
V>
-
truncate
public void truncate()Should not be called. -
invoke
Should not be called.- Specified by:
invoke
in interfaceInvocableMap<K,
V> - Overrides:
invoke
in classWrapperNamedCache<K,
V> - Type Parameters:
R
- the type of value returned by the EntryProcessor- Parameters:
key
- the key to process; it is not required to exist within the Mapagent
- the EntryProcessor to use to process the specified key- Returns:
- the result of the invocation as returned from the EntryProcessor
-
invokeAll
public <R> Map<K,R> invokeAll(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K, V, R> agent) Should not be called.- Specified by:
invokeAll
in interfaceInvocableMap<K,
V> - Overrides:
invokeAll
in classWrapperNamedCache<K,
V> - Type Parameters:
R
- the type of value returned by the EntryProcessor- Parameters:
collKeys
- the keys to process; these keys are not required to exist within the Mapagent
- 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
Should not be called.- Specified by:
invokeAll
in interfaceInvocableMap<K,
V> - Overrides:
invokeAll
in classWrapperNamedCache<K,
V> - Type Parameters:
R
- the type of value returned by the EntryProcessor- Parameters:
filter
- a Filter that results in the set of keys to be processedagent
- 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
Should not be called.- Specified by:
put
in interfaceCacheMap<K,
V> - Specified by:
put
in interfaceConcurrentMap<K,
V> - Specified by:
put
in interfaceMap<K,
V> - Overrides:
put
in classWrapperConcurrentMap<K,
V> - Parameters:
oKey
- key with which the specified value is to be associatedoValue
- 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
Should not be called. -
remove
Should not be called.- Specified by:
remove
in interfaceConcurrentMap<K,
V> - Specified by:
remove
in interfaceMap<K,
V> - Overrides:
remove
in classWrapperConcurrentMap<K,
V> - 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. -
lock
Should not be called.- Specified by:
lock
in interfaceConcurrentMap<K,
V> - Overrides:
lock
in classWrapperConcurrentMap<K,
V> - Parameters:
oKey
- key being lockedcWait
- 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
Should not be called.- Specified by:
lock
in interfaceConcurrentMap<K,
V> - Overrides:
lock
in classWrapperConcurrentMap<K,
V> - Parameters:
oKey
- key being locked- Returns:
- true if the item was successfully locked; false otherwise
-
unlock
Should not be called.- Specified by:
unlock
in interfaceConcurrentMap<K,
V> - Overrides:
unlock
in classWrapperConcurrentMap<K,
V> - Parameters:
oKey
- key being unlocked- Returns:
- true if the item was successfully unlocked; false otherwise
-
removeBlind
Should not be called.- Overrides:
removeBlind
in classWrapperConcurrentMap<K,
V> - 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.
-