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
Fields Modifier and Type Field Description protected Collection<E>m_colDelegateThe Collection to which this wrapper delegates.protected ReadWriteLockm_lockThe read/write lock for concurrency control.protected Lockm_lockExclusiveThe exclusive lock for performing read/write operations.protected Lockm_lockSharedThe shared lock for performing read operations.
-
Constructor Summary
Constructors Modifier Constructor Description ConcurrentWrapperCollection(Collection<E> col)Create 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E o)booleanaddAll(Collection<? extends E> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanequals(Object oOther)protected Collection<E>getDelegate()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<E>iterator()booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)intsize()Object[]toArray()<T> T[]toArray(T[] a)StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Field Detail
-
m_colDelegate
protected final Collection<E> m_colDelegate
The Collection to which this wrapper delegates.
-
m_lock
protected final ReadWriteLock m_lock
The read/write lock for concurrency control.
-
m_lockShared
protected final Lock m_lockShared
The shared lock for performing read operations.
-
m_lockExclusive
protected final Lock m_lockExclusive
The exclusive lock for performing read/write operations.
-
-
Constructor Detail
-
ConcurrentWrapperCollection
public ConcurrentWrapperCollection(Collection<E> col)
Create an ConcurrentWrapperCollection which delegates to the specified Collection.- Parameters:
col- the Collection to delegate all calls to
-
ConcurrentWrapperCollection
protected ConcurrentWrapperCollection(Collection<E> col, ReadWriteLock lock)
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 Detail
-
getDelegate
protected Collection<E> getDelegate()
Return the Collection to which all operations should be delegated to.- Returns:
- the wrapped Collection
-
getLock
protected ReadWriteLock 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
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<E>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfaceCollection<E>
-
add
public boolean add(E o)
- Specified by:
addin interfaceCollection<E>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<E>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<E>
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAllin interfaceCollection<E>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<E>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<E>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<E>
-
equals
public boolean equals(Object oOther)
- Specified by:
equalsin interfaceCollection<E>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<E>- Overrides:
hashCodein classObject
-
-