Package com.tangosol.util
Class WrapperCollections.ConcurrentWrapperCollection<E>
java.lang.Object
com.tangosol.util.WrapperCollections.ConcurrentWrapperCollection<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>
- Direct Known Subclasses:
WrapperCollections.ConcurrentWrapperSet
- Enclosing class:
- WrapperCollections
public static class WrapperCollections.ConcurrentWrapperCollection<E>
extends Object
implements Collection<E>
Collection implementation which uses a ReadWriteLock to manage
concurrent access to an underlying Collection.
- Since:
- Coherence 3.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Collection<E>The Collection to which this wrapper delegates.protected final ReadWriteLockThe read/write lock for concurrency control.protected final LockThe exclusive lock for performing read/write operations.protected final LockThe shared lock for performing read operations. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate an ConcurrentWrapperCollection which delegates to the specified Collection.protectedConcurrentWrapperCollection(Collection<E> col, ReadWriteLock lock) Create an ConcurrentWrapperCollection which delegates to the specified Collection. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanprotected Collection<E>Return the Collection to which all operations should be delegated to.protected ReadWriteLockgetLock()Return the ReadWriteLock that is used to manage concurrent access and modifications to the underlying map.inthashCode()booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Object[]toArray()<T> T[]toArray(T[] a) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
m_colDelegate
The Collection to which this wrapper delegates. -
m_lock
The read/write lock for concurrency control. -
m_lockExclusive
The exclusive lock for performing read/write operations.
-
-
Constructor Details
-
ConcurrentWrapperCollection
Create an ConcurrentWrapperCollection which delegates to the specified Collection.- Parameters:
col- the Collection to delegate all calls to
-
ConcurrentWrapperCollection
Create an ConcurrentWrapperCollection which delegates to the specified Collection.- Parameters:
col- the Collection to delegate all calls tolock- a read/write lock for concurrency management
-
-
Method Details
-
getDelegate
Return the Collection to which all operations should be delegated to.- Returns:
- the wrapped Collection
-
getLock
Return the ReadWriteLock that is used to manage concurrent access and modifications to the underlying map.- Returns:
- the ReadWriteLock
-
size
public int size()- Specified by:
sizein interfaceCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>
-
iterator
-
toArray
- Specified by:
toArrayin interfaceCollection<E>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<E>
-
add
- Specified by:
addin interfaceCollection<E>
-
remove
- Specified by:
removein interfaceCollection<E>
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>
-
addAll
- Specified by:
addAllin interfaceCollection<E>
-
retainAll
- Specified by:
retainAllin interfaceCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>
-
equals
- Specified by:
equalsin interfaceCollection<E>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<E>- Overrides:
hashCodein classObject
-
toString
-