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
Modifier and TypeFieldDescriptionprotected final Collection
<E> The Collection to which this wrapper delegates.protected final ReadWriteLock
The read/write lock for concurrency control.protected final Lock
The exclusive lock for performing read/write operations.protected final Lock
The shared lock for performing read operations. -
Constructor Summary
ModifierConstructorDescriptionCreate an ConcurrentWrapperCollection which delegates to the specified Collection.protected
ConcurrentWrapperCollection
(Collection<E> col, ReadWriteLock lock) Create an ConcurrentWrapperCollection which delegates to the specified Collection. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends E> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
protected Collection
<E> Return the Collection to which all operations should be delegated to.protected ReadWriteLock
getLock()
Return the ReadWriteLock that is used to manage concurrent access and modifications to the underlying map.int
hashCode()
boolean
isEmpty()
iterator()
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) toString()
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 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:
size
in interfaceCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
-
iterator
-
toArray
- Specified by:
toArray
in interfaceCollection<E>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArray
in interfaceCollection<E>
-
add
- Specified by:
add
in interfaceCollection<E>
-
remove
- Specified by:
remove
in interfaceCollection<E>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
-
addAll
- Specified by:
addAll
in interfaceCollection<E>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
-
equals
- Specified by:
equals
in interfaceCollection<E>
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<E>
- Overrides:
hashCode
in classObject
-
toString
-