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.volatile OutriggerAdmin server
private volatile EntryRep[] reps
private volatile int next
delete()
we will call iter.delete() next - 1private final int fetchSize
private volatile 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
AdminIteratornull
if there are no more matching entries in the space.
This method is idempotent in the face of RemoteExceptions.
next in interface AdminIteratorUnusableEntryException - if the field of next entry in
sequence can't be deserialized (usually this is because the class
in question could not be loaded).RemoteExceptionpublic void delete()
throws RemoteException
AdminIteratornext():
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 AdminIteratorRemoteExceptionpublic void close()
throws RemoteException
AdminIteratorclose() method.
This method is idempotent in the face of RemoteException.
close in interface AdminIteratorRemoteExceptionprivate void assertOpen()
throws IllegalStateException
IllegalStateException if this iterator
has been closed; otherwise just return.IllegalStateExceptionCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.