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.LockNested classes/interfaces inherited from class com.tangosol.util.WrapperObservableMap
WrapperObservableMap.InternalListenerNested classes/interfaces inherited from class com.tangosol.util.AbstractKeySetBasedMap
AbstractKeySetBasedMap.EntrySet, AbstractKeySetBasedMap.KeyIterator, AbstractKeySetBasedMap.KeySet, AbstractKeySetBasedMap.ValuesCollectionNested classes/interfaces inherited from class com.tangosol.util.AbstractKeyBasedMap
AbstractKeyBasedMap.DeferredCacheEvent<K,V> Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriterNested 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.OptionNested classes/interfaces inherited from interface com.tangosol.util.QueryMap
QueryMap.Entry<K,V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanSpecifies 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_sNameFields inherited from class com.tangosol.util.WrapperConcurrentMap
m_cWaitMillis, m_fEnforceLocking, m_gateMap, m_mapLockFields inherited from class com.tangosol.util.WrapperObservableMap
m_fDeferredEvent, m_fTranslateEvents, m_listenerInternal, m_listenerSupport, m_map, m_statsFields inherited from class com.tangosol.util.Base
DEFAULT_LOAD_FACTOR, 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_USFields inherited from interface com.tangosol.net.cache.CacheMap
EXPIRY_DEFAULT, EXPIRY_NEVERFields inherited from interface com.tangosol.util.ConcurrentMap
LOCK_ALL -
Constructor Summary
ConstructorsConstructorDescriptionReadonlyNamedCache(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 voidEnforce the "strict" read-only policy.voidclear()Should not be called.voiddestroy()Should not be called.<R> Rinvoke(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.booleanShould not be called.booleanShould not be called.Should not be called.voidShould not be called.Should not be called.protected booleanremoveBlind(Object oKey) Should not be called.voidtruncate()Should not be called.booleanShould 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, removeIndexMethods inherited from class com.tangosol.util.WrapperConcurrentMap
getDescription, getLockDescription, getWaitMillis, instantiateLock, isInternalKeySetIteratorMutable, isLockingEnforced, setLockingEnforced, setWaitMillis, toStringMethods 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, setTranslateEventsMethods inherited from class com.tangosol.util.AbstractKeySetBasedMap
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateKeySet, instantiateValues, isEmpty, iterateKeys, sizeMethods inherited from class com.tangosol.util.AbstractKeyBasedMap
clone, entrySet, keySet, valuesMethods 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, newHashMap, newHashMap, newHashSet, newHashSet, 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, waitMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.tangosol.util.ConcurrentMap
containsKey, containsValue, get, isEmpty, sizeMethods 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, streamMethods inherited from interface com.tangosol.net.NamedMap
getName, getServiceMethods inherited from interface com.tangosol.util.ObservableMap
addMapListener, addMapListener, addMapListener, removeMapListener, removeMapListener, removeMapListenerMethods inherited from interface com.tangosol.util.QueryMap
addIndex, forEach, forEach, values, valuesMethods 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:
destroyin interfaceNamedCollection- Overrides:
destroyin classWrapperNamedCache<K,V>
-
truncate
public void truncate()Should not be called. -
invoke
Should not be called.- Specified by:
invokein interfaceInvocableMap<K,V> - Overrides:
invokein 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:
invokeAllin interfaceInvocableMap<K,V> - Overrides:
invokeAllin 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:
invokeAllin interfaceInvocableMap<K,V> - Overrides:
invokeAllin 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:
putin interfaceCacheMap<K,V> - Specified by:
putin interfaceConcurrentMap<K,V> - Specified by:
putin interfaceMap<K,V> - Overrides:
putin 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:
removein interfaceConcurrentMap<K,V> - Specified by:
removein interfaceMap<K,V> - Overrides:
removein 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:
lockin interfaceConcurrentMap<K,V> - Overrides:
lockin 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:
lockin interfaceConcurrentMap<K,V> - Overrides:
lockin 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:
unlockin interfaceConcurrentMap<K,V> - Overrides:
unlockin classWrapperConcurrentMap<K,V> - Parameters:
oKey- key being unlocked- Returns:
- true if the item was successfully unlocked; false otherwise
-
removeBlind
Should not be called.- Overrides:
removeBlindin 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.
-