Package org.apache.ignite
Interface IgniteSet<T>
-
- All Superinterfaces:
AutoCloseable
,Closeable
,Collection<T>
,Iterable<T>
,Set<T>
public interface IgniteSet<T> extends Set<T>, Closeable
Set implementation based on on In-Memory Data Grid.Overview
Cache set implementsSet
interface and provides all methods from collections. Note that allCollection
methods in the set may throwIgniteException
in case of failure or if set was removed.Collocated vs Non-collocated
Set items can be placed on one node or distributed throughout grid nodes (governed bycollocated
parameter).Non-collocated
mode is provided only for partitioned caches. Ifcollocated
parameter istrue
, then all set items will be collocated on one node, otherwise items will be distributed through all grid nodes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(T t)
boolean
addAll(Collection<? extends T> c)
<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).void
affinityRun(IgniteRunnable job)
Executes given job on collocated set on the node where the set is located (a.k.a. affinity co-location).void
clear()
void
close()
Removes this set.boolean
collocated()
Returnstrue
if this set can be kept on the one node only.boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
isEmpty()
Iterator<T>
iterator()
String
name()
Gets set name.boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
removed()
Gets status of set.boolean
retainAll(Collection<?> c)
int
size()
Object[]
toArray()
<T1> T1[]
toArray(T1[] a)
<T1> IgniteSet<T1>
withKeepBinary()
Returns Ignite set that operates on binary objects without deserialization.-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
-
-
-
Method Detail
-
add
boolean add(T t) throws IgniteException
- Specified by:
add
in interfaceCollection<T>
- Specified by:
add
in interfaceSet<T>
- Throws:
IgniteException
-
addAll
boolean addAll(Collection<? extends T> c) throws IgniteException
- Specified by:
addAll
in interfaceCollection<T>
- Specified by:
addAll
in interfaceSet<T>
- Throws:
IgniteException
-
clear
void clear() throws IgniteException
- Specified by:
clear
in interfaceCollection<T>
- Specified by:
clear
in interfaceSet<T>
- Throws:
IgniteException
-
contains
boolean contains(Object o) throws IgniteException
- Specified by:
contains
in interfaceCollection<T>
- Specified by:
contains
in interfaceSet<T>
- Throws:
IgniteException
-
containsAll
boolean containsAll(Collection<?> c) throws IgniteException
- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceSet<T>
- Throws:
IgniteException
-
isEmpty
boolean isEmpty() throws IgniteException
- Specified by:
isEmpty
in interfaceCollection<T>
- Specified by:
isEmpty
in interfaceSet<T>
- Throws:
IgniteException
-
iterator
Iterator<T> iterator() throws IgniteException
- Specified by:
iterator
in interfaceCollection<T>
- Specified by:
iterator
in interfaceIterable<T>
- Specified by:
iterator
in interfaceSet<T>
- Throws:
IgniteException
-
remove
boolean remove(Object o) throws IgniteException
- Specified by:
remove
in interfaceCollection<T>
- Specified by:
remove
in interfaceSet<T>
- Throws:
IgniteException
-
removeAll
boolean removeAll(Collection<?> c) throws IgniteException
- Specified by:
removeAll
in interfaceCollection<T>
- Specified by:
removeAll
in interfaceSet<T>
- Throws:
IgniteException
-
retainAll
boolean retainAll(Collection<?> c) throws IgniteException
- Specified by:
retainAll
in interfaceCollection<T>
- Specified by:
retainAll
in interfaceSet<T>
- Throws:
IgniteException
-
size
int size() throws IgniteException
- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceSet<T>
- Throws:
IgniteException
-
toArray
Object[] toArray() throws IgniteException
- Specified by:
toArray
in interfaceCollection<T>
- Specified by:
toArray
in interfaceSet<T>
- Throws:
IgniteException
-
toArray
<T1> T1[] toArray(T1[] a) throws IgniteException
- Specified by:
toArray
in interfaceCollection<T>
- Specified by:
toArray
in interfaceSet<T>
- Throws:
IgniteException
-
close
void close() throws IgniteException
Removes this set. In order to check the state it is possible to useremoved()
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IgniteException
- If operation failed.
-
name
String name()
Gets set name.- Returns:
- Set name.
-
collocated
boolean collocated()
Returnstrue
if this set can be kept on the one node only. Returnsfalse
if this set can be kept on the many nodes.- Returns:
True
if this set is incollocated
modefalse
otherwise.
-
removed
boolean removed()
Gets status of set. In order to change the status it is possible to useclose()
method.- Returns:
True
if set was removed from cachefalse
otherwise.
-
affinityRun
void affinityRun(IgniteRunnable job) throws IgniteException
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.
- Parameters:
job
- Job which will be co-located with the set.- Throws:
IgniteException
- If job failed.
-
affinityCall
<R> R affinityCall(IgniteCallable<R> job) throws IgniteException
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.
- Type Parameters:
R
- Type of the job result.- Parameters:
job
- Job which will be co-located with the set.- Returns:
- Job result.
- Throws:
IgniteException
- If job failed.
-
withKeepBinary
<T1> IgniteSet<T1> withKeepBinary()
Returns Ignite set that operates on binary objects without deserialization.- Type Parameters:
T1
- Type of binary objects.- Returns:
- New set instance for binary objects.
-
-