class IteratorProxy extends Object implements AdminIterator
IteratorProxy
uses a RemoteIter
reference
to talk to the server. The RemoteIter
object is its
partner on the server side.
Note, because there is no way to duplicate one of these objects, or
get a new reference to the underlying iteration one (a situation
that is unlikely to change since part of the iteration is local), we
don't need to do anything special for equality. The default
implementations of equals
and hashCode
work fine.
Modifier and Type | Field and Description |
---|---|
private int |
fetchSize
How many entries to ask for each time we go to the server
|
private Uuid |
iterationUuid
The
Uuid of the iteration this
proxy is associated with. |
private Uuid |
lastId
ID of last entry we got from server
|
private int |
next
Index of the next entry in rep to return.
|
private EntryRep[] |
reps
Last set of reps we got from the server
|
(package private) OutriggerAdmin |
server
Reference to the server.
|
Constructor and Description |
---|
IteratorProxy(Uuid iterationUuid,
OutriggerAdmin server,
int fetchSize)
Create client side iterator proxy.
|
Modifier and Type | Method and Description |
---|---|
private void |
assertOpen()
Throw
IllegalStateException if this iterator
has been closed; otherwise just return. |
void |
close()
Tell the server that this iterator is no longer in use.
|
void |
delete()
The effect of this call depends on the most recent call to
next() :
If the last call to next() returned an
Entry that entry will be removed from the space. |
Entry |
next()
Return the next entry in the sequence.
|
String |
toString() |
private final Uuid iterationUuid
Uuid
of the iteration this
proxy is associated with.OutriggerAdmin server
private EntryRep[] reps
private int next
delete()
we will call iter.delete()
next - 1private final int fetchSize
private Uuid lastId
IteratorProxy(Uuid iterationUuid, OutriggerAdmin server, int fetchSize)
iterationUuid
- The identity of the iteration this proxy is for.server
- reference to remote server for the space.fetchSize
- Number of entries to ask for when it goes to the
serverNullPointerException
- if server
or
iterationUuid
is null
.public Entry next() throws UnusableEntryException, RemoteException
AdminIterator
null
if there are no more matching entries in the space.
This method is idempotent in the face of RemoteException
s.
next
in interface AdminIterator
UnusableEntryException
- if the field of next entry in
sequence can't be deserialized (usually this is because the class
in question could not be loaded).RemoteException
public void delete() throws RemoteException
AdminIterator
next()
:
next()
returned an
Entry
that entry will be removed from the space.
next()
threw a
UnusableEntryException
the Entry
that
could not be deserialized will be removed from the space.
next()
returned
null
, threw a RemoteException
, or
next()
has not yet been called on this iterator a
IllegalStateException
will be thrown and no entry will
be removed.
RemoteException
.
delete
in interface AdminIterator
RemoteException
public void close() throws RemoteException
AdminIterator
close()
method.
This method is idempotent in the face of RemoteException
.
close
in interface AdminIterator
RemoteException
private void assertOpen() throws IllegalStateException
IllegalStateException
if this iterator
has been closed; otherwise just return.IllegalStateException
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.