GigaSpace.iterator(Object)
or one of its overloads instead.@Deprecated public class IteratorBuilder extends Object
GSIterator
. Allows to use method
chaining for simple configuration of an iterator and then call iterate()
to get the
actual iterator.
By default, when no template is added (using addTemplate(ISpaceQuery)
or addTemplate(Object)
, a null template will be used to iterate over all the content of the
Space.
The iterator can iterate on entries currently in the space, future entries or both. By
default it will only iterate on future entries in the Space (entries that match the given
template(s)). Use iteratorScope(IteratorScope)
to set the iterator's scope.
Lease for the iterator can be controlled using leaseDuration(long)
. A leased
iterator which expires is considered as invalidated. A canceled iterator is an exhausted
iterator and will have no more entities added to it. Calling next
on an iterator
with either state always returns null
or it may throw one of the allowed exceptions.
In particular next(timeout)
may throw NoSuchObjectException
to
indicate that no entity has been found during the allowed timeout. There is no guarantee that
once next(timeout)
throws a NoSuchObjectException
, or next
returns null
, all future calls on that instance will do the same.
If there is a possibility that an iterator may become invalidated, it must be leased. If
there is no possibility that the iterator will become invalidated, implementations should not
lease it (i.e. use Lease.FOREVER
). If there is no further interest an iterator may be
canceled
.
An active lease on an iterator serves as a hint to the space that the client is still interested in matching entities, and as a hint to the client that the iterator is still functioning. There are cases, however, where this may not be possible in particular, it is not expected that iteration will maintain across crashes. If the lease expires or is canceled, the iterator is invalidated. Clients should not assume that the resources associated with a leased match set will be freed if the match set reaches the exhausted state, and should instead cancel the lease.
The maximum number of entries to pull from the space can be controlled using bufferSize(int)
and defaults to 100
.
GigaSpace.iterator()
Constructor and Description |
---|
IteratorBuilder(GigaSpace gigaSpace)
Deprecated.
Constructs a new iterator builder using the given GigaSpace.
|
Modifier and Type | Method and Description |
---|---|
IteratorBuilder |
addTemplate(ISpaceQuery query)
Deprecated.
Adds a template that will be used to control the matching entries the iterator will iterate
over.
|
IteratorBuilder |
addTemplate(Object template)
Deprecated.
Adds a template that will be used to control the matching entries the iterator will iterate
over.
|
IteratorBuilder |
bufferSize(int bufferSize)
Deprecated.
The maximum number of entries to pull from the space can be controlled using
bufferSize(int) and defaults to 100 . |
GSIterator |
create()
Deprecated.
Returns a new
GSIterator based on the builder configuration. |
IteratorBuilder |
eventSessionConfig(EventSessionConfig eventSessionConfig)
Deprecated.
The event session configuration to be used when subscribing for notifications.
|
GSIterator |
iterate()
Deprecated.
|
IteratorBuilder |
iteratorScope(IteratorScope iteratorScope)
Deprecated.
Determines iterator's scope: current entries, future entries or both.
|
IteratorBuilder |
leaseDuration(long leaseDuration)
Deprecated.
The requested initial lease time on the resulting match set.
|
public IteratorBuilder(GigaSpace gigaSpace)
public IteratorBuilder iteratorScope(IteratorScope iteratorScope)
public IteratorBuilder bufferSize(int bufferSize)
The maximum number of entries to pull from the space can be controlled using bufferSize(int)
and defaults to 100
.
public IteratorBuilder leaseDuration(long leaseDuration)
FOREVER
.public IteratorBuilder eventSessionConfig(EventSessionConfig eventSessionConfig)
public IteratorBuilder addTemplate(Object template)
public IteratorBuilder addTemplate(ISpaceQuery query)
public GSIterator create()
GSIterator
based on the builder configuration.
If no templates were added, a null template will be added which will cause the iterator to
iterate over all the entries in the Space.public GSIterator iterate()
create().
Copyright © GigaSpaces.