Class GridCacheSetImpl<T>
- java.lang.Object
-
- java.util.AbstractCollection<T>
-
- org.apache.ignite.internal.processors.datastructures.GridCacheSetImpl<T>
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<T>,Collection<T>,Set<T>,IgniteSet<T>
public class GridCacheSetImpl<T> extends AbstractCollection<T> implements IgniteSet<T>
Cache set implementation.
-
-
Constructor Summary
Constructors Constructor Description GridCacheSetImpl(GridCacheContext ctx, String name, GridCacheSetHeader hdr, boolean keepBinary)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T o)booleanaddAll(Collection<? extends T> c)<R> RaffinityCall(IgniteCallable<R> job)Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).voidaffinityRun(IgniteRunnable job)Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).voidclear()voidclose()Removes this set.booleancollocated()Returnstrueif this set can be kept on the one node only.booleancontains(Object o)booleancontainsAll(Collection<?> c)GridCacheContextcontext()IgniteUuidid()booleanisEmpty()Iterator<T>iterator()Stringname()Gets set name.booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanremoved()Gets status of set.booleanretainAll(Collection<?> c)intsize()StringtoString()<T1> IgniteSet<T1>withKeepBinary()Returns Ignite set that operates on binary objects without deserialization.-
Methods inherited from class java.util.AbstractCollection
toArray, toArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
-
-
-
Constructor Detail
-
GridCacheSetImpl
public GridCacheSetImpl(GridCacheContext ctx, String name, GridCacheSetHeader hdr, boolean keepBinary)
- Parameters:
ctx- Cache context.name- Set name.hdr- Set header.
-
-
Method Detail
-
collocated
public boolean collocated()
Returnstrueif this set can be kept on the one node only. Returnsfalseif this set can be kept on the many nodes.- Specified by:
collocatedin interfaceIgniteSet<T>- Returns:
Trueif this set is incollocatedmodefalseotherwise.
-
name
public String name()
Gets set name.
-
removed
public boolean removed()
Gets status of set. In order to change the status it is possible to useIgniteSet.close()method.
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(Object o)
-
add
public boolean add(T o)
-
remove
public boolean remove(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceIgniteSet<T>- Specified by:
containsAllin interfaceSet<T>- Overrides:
containsAllin classAbstractCollection<T>
-
addAll
public boolean addAll(Collection<? extends T> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
clear
public void clear()
-
affinityRun
public void affinityRun(IgniteRunnable job)
Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).This is not supported for non-collocated sets.
- Specified by:
affinityRunin interfaceIgniteSet<T>- Parameters:
job- Job which will be co-located with the set.
-
affinityCall
public <R> R affinityCall(IgniteCallable<R> job)
Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).This is not supported for non-collocated sets.
- Specified by:
affinityCallin interfaceIgniteSet<T>- Type Parameters:
R- Type of the job result.- Parameters:
job- Job which will be co-located with the set.- Returns:
- Job result.
-
withKeepBinary
public <T1> IgniteSet<T1> withKeepBinary()
Returns Ignite set that operates on binary objects without deserialization.- Specified by:
withKeepBinaryin interfaceIgniteSet<T>- Type Parameters:
T1- Type of binary objects.- Returns:
- New set instance for binary objects.
-
close
public void close()
Removes this set. In order to check the state it is possible to useIgniteSet.removed().
-
id
public IgniteUuid id()
- Returns:
- Set ID.
-
context
public GridCacheContext context()
- Returns:
- Cache context.
-
toString
public String toString()
- Overrides:
toStringin classAbstractCollection<T>
-
-