com.sun.jini.outrigger
Class IteratorProxy

java.lang.Object
  extended by com.sun.jini.outrigger.IteratorProxy
All Implemented Interfaces:
AdminIterator
Direct Known Subclasses:
ConstrainableIteratorProxy

 class IteratorProxy
extends Object
implements AdminIterator

The iterator that is returned to the client. 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.


Field Summary
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 Summary
IteratorProxy(Uuid iterationUuid, OutriggerAdmin server, int fetchSize)
          Create client side iterator proxy.
 
Method Summary
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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

iterationUuid

private final Uuid iterationUuid
The Uuid of the iteration this proxy is associated with.


server

OutriggerAdmin server
Reference to the server. Only assigned by this class.


reps

private EntryRep[] reps
Last set of reps we got from the server


next

private int next
Index of the next entry in rep to return. If delete() we will call iter.delete() next - 1


fetchSize

private final int fetchSize
How many entries to ask for each time we go to the server


lastId

private Uuid lastId
ID of last entry we got from server

Constructor Detail

IteratorProxy

IteratorProxy(Uuid iterationUuid,
              OutriggerAdmin server,
              int fetchSize)
Create client side iterator proxy.

Parameters:
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 server
Throws:
NullPointerException - if server or iterationUuid is null.
Method Detail

next

public Entry next()
           throws UnusableEntryException,
                  RemoteException
Description copied from interface: AdminIterator
Return the next entry in the sequence. Returns null if there are no more matching entries in the space.

This method is idempotent in the face of RemoteExceptions.

Specified by:
next in interface AdminIterator
Throws:
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

delete

public void delete()
            throws RemoteException
Description copied from interface: AdminIterator
The effect of this call depends on the most recent call to next(): This method is idempotent in the face of RemoteException.

Specified by:
delete in interface AdminIterator
Throws:
RemoteException

close

public void close()
           throws RemoteException
Description copied from interface: AdminIterator
Tell the server that this iterator is no longer in use. All operations on a closed iterator have undefined results, except the close() method.

This method is idempotent in the face of RemoteException.

Specified by:
close in interface AdminIterator
Throws:
RemoteException

assertOpen

private void assertOpen()
                 throws IllegalStateException
Throw IllegalStateException if this iterator has been closed; otherwise just return.

Throws:
IllegalStateException

toString

public String toString()
Overrides:
toString in class Object


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.