Interface ClientIgniteSet<T>
-
- All Superinterfaces:
AutoCloseable
,Closeable
,Collection<T>
,Iterable<T>
,Set<T>
public interface ClientIgniteSet<T> extends Set<T>, Closeable
Distributed Set.Overview
Cache set implementsSet
interface and provides all methods from collections.Colocated vs Non-colocated
Set items can be placed on one node or distributed across grid nodes (governed byClientCollectionConfiguration.setColocated(boolean)
parameter).Non-colocated
mode is provided only for partitioned caches. Ifcolocated
parameter istrue
, then all set items will be colocated on one node, otherwise items will be distributed across all grid nodes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(T o)
boolean
addAll(Collection<? extends T> c)
void
clear()
void
close()
Removes this set.boolean
colocated()
Gets a value indicating whether all items of this set are stored on a single node.boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
isEmpty()
ClientAutoCloseableIterator<T>
iterator()
Returns an iterator over the elements in this collection.String
name()
Gets set name.int
pageSize()
Gets the page size to be used for batched network data retrieval initerator()
andtoArray()
.ClientIgniteSet<T>
pageSize(int pageSize)
Sets the page size to be used for batched network data retrieval initerator()
andtoArray()
.boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
removed()
Gets a value indicating whether this set has been removed (close()
was called).boolean
retainAll(Collection<?> c)
boolean
serverKeepBinary()
Gets a value indicating whether user objects should be kept in binary form on the server, or deserialized.ClientIgniteSet<T>
serverKeepBinary(boolean keepBinary)
Sets a value indicating whether user objects should be kept in binary form on the server, or deserialized.int
size()
Object[]
toArray()
<T1> T1[]
toArray(T1[] a)
-
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 o)
-
addAll
boolean addAll(Collection<? extends T> c)
-
clear
void clear()
-
contains
boolean contains(Object o)
-
containsAll
boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceSet<T>
-
isEmpty
boolean isEmpty()
-
iterator
ClientAutoCloseableIterator<T> iterator()
Returns an iterator over the elements in this collection.There are no guarantees concerning the order in which the elements are returned.
Returned iterator is
AutoCloseable
: it may hold server-side resources and must be closed. It will close itself when the last page of data (seepageSize()
) is fetched from the server. WhenIterator.hasNext()
returnsfalse
, it is guaranteed that the iterator is closed. In other cases (incomplete iteration) the user must close the iterator.
-
remove
boolean remove(Object o)
-
removeAll
boolean removeAll(Collection<?> c)
-
retainAll
boolean retainAll(Collection<?> c)
-
size
int size()
-
toArray
Object[] toArray()
-
toArray
<T1> T1[] toArray(T1[] a)
-
close
void close()
Removes this set.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
name
String name()
Gets set name.- Returns:
- Set name.
-
colocated
boolean colocated()
Gets a value indicating whether all items of this set are stored on a single node.- Returns:
True
if all items of this set are stored on a single node,false
otherwise.
-
removed
boolean removed()
Gets a value indicating whether this set has been removed (close()
was called).- Returns:
True
if set was removed from cache,false
otherwise.
-
serverKeepBinary
ClientIgniteSet<T> serverKeepBinary(boolean keepBinary)
Sets a value indicating whether user objects should be kept in binary form on the server, or deserialized.Default is
true
: does not require classes on server, interoperable with other thin clients, performs better. Suitable for most use cases.Set to
false
if there is a requirement to use deserialized objects in "thick" API (IgniteSet
) together with thin client API, like in this scenario:ClientIgniteSet<UserObj> clientSet = client.set("my-set", new ClientCollectionConfiguration()); clientSet.serverKeepBinary(false); IgniteSet<UserObj> serverSet = server.set(clientSet.name(), null); clientSet.add(new UserObj(1, "client")); assert serverSet.contains(new UserObj(1, "client"));
- Parameters:
keepBinary
- Whether to keep objects in binary form on the server.- Returns:
- This set instance (for chaining).
-
serverKeepBinary
boolean serverKeepBinary()
Gets a value indicating whether user objects should be kept in binary form on the server, or deserialized.Default is
true
: does not require classes on server, interoperable with other thin clients, performs better. Suitable for most use cases.Set to
false
if there is a requirement to use deserialized objects in "thick" API (IgniteSet
) together with thin client API, like in this scenario:ClientIgniteSet<UserObj> clientSet = client.set("my-set", new ClientCollectionConfiguration()); clientSet.serverKeepBinary(false); IgniteSet<UserObj> serverSet = server.set(clientSet.name(), null); clientSet.add(new UserObj(1, "client")); assert serverSet.contains(new UserObj(1, "client"));
- Returns:
true
when user objects will be kept in binary form on the server,false
otherwise.
-
pageSize
ClientIgniteSet<T> pageSize(int pageSize)
Sets the page size to be used for batched network data retrieval initerator()
andtoArray()
.- Parameters:
pageSize
- Page size.- Returns:
- This set instance (for chaining).
-
pageSize
int pageSize()
Gets the page size to be used for batched network data retrieval initerator()
andtoArray()
.- Returns:
- Page size.
-
-