com.sun.jini.mercury
Class RemoteEventIteratorImpl

java.lang.Object
  extended by com.sun.jini.mercury.RemoteEventIteratorImpl
All Implemented Interfaces:
RemoteEventIterator

 class RemoteEventIteratorImpl
extends Object
implements RemoteEventIterator

Since:
1.1
Author:
Sun Microsystems, Inc.

Nested Class Summary
private static class RemoteEventIteratorImpl.LocalRemoteEventData
           
 
Field Summary
private  boolean invalidated
          Boolean flag indicating the (in)validity of this object.
private  Object invalidatedLock
          lock object protecting invalidated flag.
private  Iterator iter
          Event iterator
(package private)  Uuid iteratorID
          Unique identifier for this registration
private  Object lastEventCookie
          Last remote event cookie
(package private)  MailboxBackEnd mailbox
          Reference to service implementation
(package private)  Uuid registrationID
          Unique identifier for this registration
 
Constructor Summary
RemoteEventIteratorImpl(Uuid id, Uuid regId, MailboxBackEnd srv, Collection evts)
          Convenience constructor
 
Method Summary
private  void checkState()
          Utility method that checks the validity of this object and throws an exception if it's invalid.
 void close()
          Ends all event processing being performed by this iterator and invalidates the iterator.
private  RemoteEventIteratorImpl.LocalRemoteEventData getNextValidLocalRemoteEventData(Iterator i)
           
private  void invalidate()
          Utility method that marks this object as invalid.
 RemoteEvent next(long timeout)
          Retrieves stored event notifications, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

registrationID

final Uuid registrationID
Unique identifier for this registration


iteratorID

final Uuid iteratorID
Unique identifier for this registration


mailbox

final MailboxBackEnd mailbox
Reference to service implementation


iter

private Iterator iter
Event iterator


lastEventCookie

private Object lastEventCookie
Last remote event cookie


invalidatedLock

private Object invalidatedLock
lock object protecting invalidated flag.


invalidated

private boolean invalidated
Boolean flag indicating the (in)validity of this object. If true, the object is invalid and all public method invocations should throw InvalidIteratorException.

Constructor Detail

RemoteEventIteratorImpl

RemoteEventIteratorImpl(Uuid id,
                        Uuid regId,
                        MailboxBackEnd srv,
                        Collection evts)
Convenience constructor

Method Detail

next

public RemoteEvent next(long timeout)
                 throws RemoteException,
                        InvalidIteratorException
Description copied from interface: RemoteEventIterator
Retrieves stored event notifications, if any.

Specified by:
next in interface RemoteEventIterator
Parameters:
timeout - the maximum time, in milliseconds, the event mailbox service should wait for the receipt of an event notification associated with this iterator's registration.
Returns:
The RemoteEvent
Throws:
RemoteException - if there is a communication failure between the client and the service.
InvalidIteratorException - if called on an invalidated iterator.

getNextValidLocalRemoteEventData

private RemoteEventIteratorImpl.LocalRemoteEventData getNextValidLocalRemoteEventData(Iterator i)

close

public void close()
           throws InvalidIteratorException
Description copied from interface: RemoteEventIterator
Ends all event processing being performed by this iterator and invalidates the iterator.

Specified by:
close in interface RemoteEventIterator
Throws:
InvalidIteratorException - if called on an invalidated iterator.

checkState

private void checkState()
                 throws InvalidIteratorException
Utility method that checks the validity of this object and throws an exception if it's invalid.

Throws:
InvalidIteratorException

invalidate

private void invalidate()
Utility method that marks this object as invalid.



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